v gui runu vstup local market time

This commit is contained in:
David Brazda
2023-11-16 10:30:31 +01:00
parent b6e73c05a1
commit ce24c43218
3 changed files with 6 additions and 5 deletions

View File

@ -385,8 +385,8 @@ def run_batch_stratin(id: UUID, runReq: RunRequest):
#TODO do budoucna predelat Interval na RunDays a na zone aware datetime
#zatim testlisty dávám v cz casu
for intrvl in testlist.dates:
start_time = zonePRG.localize(datetime.fromisoformat(intrvl.start))
end_time = zonePRG.localize(datetime.fromisoformat(intrvl.end))
start_time = zoneNY.localize(datetime.fromisoformat(intrvl.start))
end_time = zoneNY.localize(datetime.fromisoformat(intrvl.end))
cal_list.append(RunDay(start = start_time, end = end_time, note=intrvl.note, id=testlist.id))
print(f"Getting intervals - RESULT ({len(cal_list)}): {cal_list}")

View File

@ -233,10 +233,10 @@ def _run_stratin(stratin_id: UUID, runReq: RunRequest):
#print(runReq)
if runReq.bt_from is not None and runReq.bt_from.tzinfo is None:
runReq.bt_from = zonePRG.localize(runReq.bt_from)
runReq.bt_from = zoneNY.localize(runReq.bt_from)
if runReq.bt_to is not None and runReq.bt_to.tzinfo is None:
runReq.bt_to = zonePRG.localize(runReq.bt_to)
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
if runReq.mode != Mode.LIVE and runReq.test_batch_id is not None or (runReq.bt_from.date() != runReq.bt_to.date()):

View File

@ -24,7 +24,7 @@ from alpaca.trading.models import Order, TradeUpdate
import numpy as np
import pandas as pd
from collections import deque
import socket
import numpy as np
def slice_dict_lists(d, last_item, to_tmstp = False):
@ -312,6 +312,7 @@ def send_to_telegram(message):
chatID = '5029424778'
apiURL = f'https://api.telegram.org/bot{apiToken}/sendMessage'
message = socket.gethostname() + " " + message
try:
response = requests.post(apiURL, json={'chat_id': chatID, 'text': message})
print(response.text)