Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECO-2637] Address missing candles issue filed on GitHub #569

Open
wants to merge 2 commits into
base: ECO-2637
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/typescript/frontend/src/components/charts/PrivateChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import {
EXCHANGE_NAME,
MS_IN_ONE_DAY,

Check warning on line 8 in src/typescript/frontend/src/components/charts/PrivateChart.tsx

View workflow job for this annotation

GitHub Actions / pre-commit

'MS_IN_ONE_DAY' is defined but never used. Allowed unused vars must match /^_/u
ResolutionStringToPeriod,
TV_CHARTING_LIBRARY_RESOLUTIONS,
WIDGET_OPTIONS,
Expand Down Expand Up @@ -132,7 +132,7 @@
listed_exchange: "",
session: "24x7",
// Note that `has_empty_bars` causes invalid `time order violation` errors if it's set to `true`.
// has_empty_bars: true,
has_empty_bars: true,
has_seconds: false,
has_intraday: true,
has_daily: true,
Expand Down Expand Up @@ -334,15 +334,14 @@

tvWidget.current.onChartReady(() => {
const chart = tvWidget.current!.activeChart();
const now = new Date();
const endDaysAgo = 0;
const endMilliseconds = now.getTime() - endDaysAgo * MS_IN_ONE_DAY;
const endTimestamp = Math.floor(new Date(endMilliseconds).getTime()) / 1000;
const to = Date.now() / 1000;
// Subtract 100h so that 100 1h candles are shown by default.
const from = to - 100 * 60 * 60;

chart
.setVisibleRange({
from: endTimestamp - (24 * 60 * 60) / 6,
to: endTimestamp,
from,
to,
})
.catch((error) => {
console.error("Error applying visible range:", error);
Expand Down
2 changes: 1 addition & 1 deletion src/typescript/frontend/src/components/charts/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const EXCHANGE_NAME = "emojicoin.fun";

export const WIDGET_OPTIONS: Omit<ChartingLibraryWidgetOptions, "datafeed" | "container"> = {
library_path: `${CDN_URL}/charting_library/`,
interval: "1" as ResolutionString,
interval: "60" as ResolutionString,
theme: "Dark" as ThemeName,
locale: "en" as LanguageCode,
custom_css_url: `${CDN_URL}/charting_library_stylesheets/emojicoin-dot-fun.css`,
Expand Down
Loading