-
Notifications
You must be signed in to change notification settings - Fork 291
Open
Description
Description
Inaccurate historical data for some equities. I just threw together a simple test to look at data visualization options, and immediately noticed some oddities with TQQQ/SQQQ, same code works perfectly fine with AAPL?
Is there something I'm missing because they're ETF's, or is there an underlying bug that I'm not aware of? I searched a bit in the issues, but didn't see anything related.
Code
def init(symbol, state: StrategyState):
interface: Interface = state.interface
resolution: float = state.resolution
variables = state.variables
variables["history"] = interface.history(symbol, 800, resolution, return_as='deque')["close"]
def bar_event(bar, symbol, state):
pass
if __name__ == "__main__":
alpaca = Alpaca()
s = Strategy(alpaca)
s.add_bar_event(bar_event, "AAPL", resolution="1d", init=init)
result = s.backtest(initial_values={"USD": 1000}, to="3y", GUI_output=False)
history = result.history['AAPL']
fig = make_subplots(rows=1, cols=1, shared_xaxes=True, vertical_spacing=None)
fig.add_trace(
go.Candlestick(
x=pd.to_datetime(history.time,unit='s'),
open=history.open,
high=history.high,
low=history.low,
close=history.close),
col=1,row=1
)
fig.show()
TQQQ in Blankly
TQQQ Actual
AAPL in Blankly
AAPL Actual
Metadata
Metadata
Assignees
Labels
No labels