Compare commits
1 Commits
bug/attach
...
feature/so
| Author | SHA1 | Date | |
|---|---|---|---|
| f3e7229051 |
@ -5,14 +5,12 @@ from v2realbot.utils.utils import slice_dict_lists,zoneUTC,safe_get, AttributeDi
|
|||||||
#id = "b11c66d9-a9b6-475a-9ac1-28b11e1b4edf"
|
#id = "b11c66d9-a9b6-475a-9ac1-28b11e1b4edf"
|
||||||
#state = AttributeDict(vars={})
|
#state = AttributeDict(vars={})
|
||||||
from rich import print
|
from rich import print
|
||||||
from traceback import format_exc
|
|
||||||
|
|
||||||
def attach_previous_data(state):
|
def attach_previous_data(state):
|
||||||
"""""
|
"""""
|
||||||
Attaches data from previous runner of the same batch.
|
Attaches data from previous runner of the same batch.
|
||||||
"""""
|
"""""
|
||||||
print("ATTACHING PREVIOUS DATA")
|
print("ATTACHING PREVIOUS DATA")
|
||||||
try:
|
|
||||||
runner : Runner
|
runner : Runner
|
||||||
#get batch_id of current runer
|
#get batch_id of current runer
|
||||||
res, runner = cs.get_runner(state.runner_id)
|
res, runner = cs.get_runner(state.runner_id)
|
||||||
@ -59,10 +57,6 @@ def attach_previous_data(state):
|
|||||||
detail = RunArchiveDetail(**val)
|
detail = RunArchiveDetail(**val)
|
||||||
#print("toto jsme si dotahnuli", detail.bars)
|
#print("toto jsme si dotahnuli", detail.bars)
|
||||||
|
|
||||||
if len(detail.bars["time"]) == 0:
|
|
||||||
print(f"no bars for runner {last_runner}")
|
|
||||||
return None
|
|
||||||
|
|
||||||
# from stratvars directives
|
# from stratvars directives
|
||||||
attach_previous_bar_data = safe_get(state.vars, "attach_previous_bar_data", 50)
|
attach_previous_bar_data = safe_get(state.vars, "attach_previous_bar_data", 50)
|
||||||
attach_previous_tick_data = safe_get(state.vars, "attach_previous_tick_data", None)
|
attach_previous_tick_data = safe_get(state.vars, "attach_previous_tick_data", None)
|
||||||
@ -73,7 +67,6 @@ def attach_previous_data(state):
|
|||||||
#time -datetime utc, updated - timestamp float
|
#time -datetime utc, updated - timestamp float
|
||||||
bars = slice_dict_lists(d=detail.bars, last_item=attach_previous_bar_data, time_to_datetime=True)
|
bars = slice_dict_lists(d=detail.bars, last_item=attach_previous_bar_data, time_to_datetime=True)
|
||||||
|
|
||||||
cbar_ids = {}
|
|
||||||
#zarovname tick spolu s bar daty
|
#zarovname tick spolu s bar daty
|
||||||
if attach_previous_tick_data is None:
|
if attach_previous_tick_data is None:
|
||||||
oldest_timestamp = bars["updated"][0]
|
oldest_timestamp = bars["updated"][0]
|
||||||
@ -105,8 +98,6 @@ def attach_previous_data(state):
|
|||||||
# if hasattr(detail, "ext_data") and "dailyBars" in detail.ext_data:
|
# if hasattr(detail, "ext_data") and "dailyBars" in detail.ext_data:
|
||||||
# state.dailyBars = detail.ext_data["dailyBars"]
|
# state.dailyBars = detail.ext_data["dailyBars"]
|
||||||
return
|
return
|
||||||
except Exception as e:
|
|
||||||
print(str(e)+format_exc())
|
|
||||||
return None
|
|
||||||
# if __name__ == "__main__":
|
# if __name__ == "__main__":
|
||||||
# attach_previous_data(state)
|
# attach_previous_data(state)
|
||||||
Reference in New Issue
Block a user