Skip to content

Commit 036365a

Browse files
committed
data v2 modifications to callbacks
1 parent eccbb22 commit 036365a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: alpaca_backtrader_api/alpacastore.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,18 @@ def run(self):
149149
async def on_listen(self, conn, stream, msg):
150150
pass
151151

152-
async def on_quotes(self, conn, subject, msg):
153-
msg._raw['time'] = msg.timestamp.to_pydatetime().timestamp()
152+
async def on_quotes(self, msg):
153+
msg._raw['time'] = msg.timestamp
154154
self.q.put(msg._raw)
155155

156-
async def on_agg_sec(self, conn, subject, msg):
157-
self.q.put(msg)
158-
159-
async def on_agg_min(self, conn, subject, msg):
160-
msg._raw['time'] = msg.end.to_pydatetime().timestamp()
156+
async def on_agg_min(self, msg):
157+
msg._raw['time'] = msg.timestamp
161158
self.q.put(msg._raw)
162159

163-
async def on_account(self, conn, stream, msg):
160+
async def on_account(self, msg):
164161
self.q.put(msg)
165162

166-
async def on_trade(self, conn, stream, msg):
163+
async def on_trade(self, msg):
167164
self.q.put(msg)
168165

169166

@@ -632,6 +629,9 @@ def _t_streaming_prices(self, dataname, timeframe, q, tmout):
632629
method = StreamingMethod.Quote
633630
elif timeframe == bt.TimeFrame.Minutes:
634631
method = StreamingMethod.MinuteAgg
632+
else:
633+
method = StreamingMethod.MinuteAgg
634+
635635

636636
streamer = Streamer(q,
637637
api_key=self.p.key_id,

0 commit comments

Comments
 (0)