From ce24c43218dd359dbee4c0bc1ca43995244c682f Mon Sep 17 00:00:00 2001 From: David Brazda Date: Thu, 16 Nov 2023 10:30:31 +0100 Subject: [PATCH] v gui runu vstup local market time --- v2realbot/controller/services.py | 4 ++-- v2realbot/main.py | 4 ++-- v2realbot/utils/utils.py | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/v2realbot/controller/services.py b/v2realbot/controller/services.py index c3f36bc..ac8e605 100644 --- a/v2realbot/controller/services.py +++ b/v2realbot/controller/services.py @@ -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}") diff --git a/v2realbot/main.py b/v2realbot/main.py index f8fec3b..2407c7c 100644 --- a/v2realbot/main.py +++ b/v2realbot/main.py @@ -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()): diff --git a/v2realbot/utils/utils.py b/v2realbot/utils/utils.py index 25ac1c6..5bc2a24 100644 --- a/v2realbot/utils/utils.py +++ b/v2realbot/utils/utils.py @@ -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)