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

The last candle is missing #48

Closed
helloboy110 opened this issue Apr 25, 2023 · 7 comments
Closed

The last candle is missing #48

helloboy110 opened this issue Apr 25, 2023 · 7 comments

Comments

@helloboy110
Copy link

The last candle is missing

@happydasch
Copy link
Owner

can you provide more details?

@helloboy110
Copy link
Author

run demos/blackly_single.py
image
image
bokeh plot:
image

@happydasch
Copy link
Owner

The last candle is not complete so it will not be generated. Will look into changing this behaviour.

@zgpnuaa
Copy link

zgpnuaa commented Jul 26, 2023

+1.
The first candlestick is not displayed, and the time of all other candlesticks is reduced by one period (1 minute) when timeframe is 1min.
My code as follow:

feed = SimpleLivingData(exchange=exchange, symbol=symbol, timeframe=bt.TimeFrame.Minutes, compression=1, backfill_start=True, backfill_from=data_start)

cerebro.adddata(feed, name=symbol)
cerebro.addanalyzer(BacktraderPlottingLive, barup='red',bardown='green', port=8065,lookback=99, scheme=Tradimo(hovertool_timeformat='%F %R:%S')) 

data_start as follow:
2023-07-26_230435
The first candlestick displayed is actually the second data in the dataframe.But time is reduced by 1 minute.
image
The last displayed candlestick is actually the last data entry in the dataframe, but the time has been reduced by 1 minute.
image

@zgpnuaa
Copy link

zgpnuaa commented Aug 3, 2023

It does not draw the first candlestick whether it is in live trading or backtesting. Instead, it starts drawing from the second candlestick. The overall time remains unchanged, meaning that the chart starts from the second candlestick but with time starting from the first candlestick's time. This results in all candlesticks having incorrect timestamps, as there is a shift of one period in time. For example, when plotting 30-minute candlesticks, the OHLC data displayed at 10:00 actually corresponds to 10:30 OHLC data and so on.

2023/06/19 10:00:00, 1_prenext: open:271.758-high:271.758-low:271.168-close:271.258
2023/06/19 10:30:00, 2_prenext: open:271.228-high:271.768-low:268.408-close:268.878
2023/06/19 11:00:00, 3_prenext: open:268.898-high:270.458-low:268.898-close:269.238
2023/06/19 11:30:00, 4_prenext: open:269.238-high:269.238-low:266.868-close:268.158
image
image

@qsyao
Copy link

qsyao commented Oct 18, 2023

same question, expecting a nice fix ! @happydasch

@Balzac1799
Copy link

Balzac1799 commented May 25, 2024

@zgpnuaa @qsyao @happydasch It seems that change this line to if c_start and c_start >= t_end can fix the missing first candle error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants