This commit is contained in:
David Brazda
2024-02-23 21:04:23 +07:00
parent c4d05f47ff
commit e75fbc7194
3 changed files with 5 additions and 3 deletions

View File

@ -1947,7 +1947,7 @@ def get_alpaca_history_bars(symbol: str, datetime_object_from: datetime, datetim
client = StockHistoricalDataClient(ACCOUNT1_LIVE_API_KEY, ACCOUNT1_LIVE_SECRET_KEY, raw_data=False)
#datetime_object_from = datetime(2023, 2, 27, 18, 51, 38, tzinfo=datetime.timezone.utc)
#datetime_object_to = datetime(2023, 2, 27, 21, 51, 39, tzinfo=datetime.timezone.utc)
bar_request = StockBarsRequest(symbol_or_symbols=symbol,timeframe=timeframe, start=datetime_object_from, end=datetime_object_to, feed=ACCOUNT1_LIVE_API_KEY)
bar_request = StockBarsRequest(symbol_or_symbols=symbol,timeframe=timeframe, start=datetime_object_from, end=datetime_object_to, feed=ACCOUNT1_LIVE_FEED)
#print("before df")
bars = client.get_stock_bars(bar_request)
result = []

View File

@ -21,7 +21,8 @@ from msgpack import packb
class Trade_WS_Streamer(Thread):
##tento ws streamer je pouze jeden pro vsechny, tzn. vyuziváme natvrdo placena data primarniho uctu (nezalezi jestli paper nebo live)
print(f"Realtime Websocket connection will use FEED: {LIVE_DATA_FEED} and credential of ACCOUNT1")
msg = f"Realtime Websocket connection will use FEED: {LIVE_DATA_FEED} and credential of ACCOUNT1"
print(msg)
client = StockDataStream(LIVE_DATA_API_KEY, LIVE_DATA_SECRET_KEY, raw_data=True, websocket_params={}, feed=LIVE_DATA_FEED)
#uniquesymbols = set()
_streams = []
@ -39,6 +40,7 @@ class Trade_WS_Streamer(Thread):
return False
def add_stream(self, obj: TradeAggregator2Queue):
print(Trade_WS_Streamer.msg)
print("stav pred pridavanim", Trade_WS_Streamer._streams)
Trade_WS_Streamer._streams.append(obj)
if Trade_WS_Streamer.client._running is False:

View File

@ -252,7 +252,7 @@ def _run_stratin(stratin_id: UUID, runReq: RunRequest):
runReq.bt_to = zoneNY.localize(runReq.bt_to)
#pokud jedeme nad test intervaly anebo je požadováno více dní - pouštíme jako batch day by day
#do budoucna dát na FE jako flag
print(runReq)
#print(runReq)
if runReq.mode not in [Mode.LIVE, Mode.PAPER] and (runReq.test_batch_id is not None or (runReq.bt_from is not None and runReq.bt_to is not None and runReq.bt_from.date() != runReq.bt_to.date())):
res, id = cs.run_batch_stratin(id=stratin_id, runReq=runReq)
else: