accept open-ended timeranges from user
This commit is contained in:
parent
d1d451c27e
commit
db66b82f6f
@ -312,6 +312,9 @@ class FreqaiDataKitchen:
|
|||||||
|
|
||||||
full_timerange = TimeRange.parse_timerange(tr)
|
full_timerange = TimeRange.parse_timerange(tr)
|
||||||
config_timerange = TimeRange.parse_timerange(self.config["timerange"])
|
config_timerange = TimeRange.parse_timerange(self.config["timerange"])
|
||||||
|
if config_timerange.stopts == 0:
|
||||||
|
config_timerange.stopts = int(datetime.datetime.now(
|
||||||
|
tz=datetime.timezone.utc).timestamp())
|
||||||
timerange_train = copy.deepcopy(full_timerange)
|
timerange_train = copy.deepcopy(full_timerange)
|
||||||
timerange_backtest = copy.deepcopy(full_timerange)
|
timerange_backtest = copy.deepcopy(full_timerange)
|
||||||
|
|
||||||
@ -589,6 +592,10 @@ class FreqaiDataKitchen:
|
|||||||
def create_fulltimerange(self, backtest_tr: str, backtest_period: int) -> str:
|
def create_fulltimerange(self, backtest_tr: str, backtest_period: int) -> str:
|
||||||
backtest_timerange = TimeRange.parse_timerange(backtest_tr)
|
backtest_timerange = TimeRange.parse_timerange(backtest_tr)
|
||||||
|
|
||||||
|
if backtest_timerange.stopts == 0:
|
||||||
|
backtest_timerange.stopts = int(datetime.datetime.now(
|
||||||
|
tz=datetime.timezone.utc).timestamp())
|
||||||
|
|
||||||
backtest_timerange.startts = backtest_timerange.startts - backtest_period * SECONDS_IN_DAY
|
backtest_timerange.startts = backtest_timerange.startts - backtest_period * SECONDS_IN_DAY
|
||||||
start = datetime.datetime.utcfromtimestamp(backtest_timerange.startts)
|
start = datetime.datetime.utcfromtimestamp(backtest_timerange.startts)
|
||||||
stop = datetime.datetime.utcfromtimestamp(backtest_timerange.stopts)
|
stop = datetime.datetime.utcfromtimestamp(backtest_timerange.stopts)
|
||||||
|
Loading…
Reference in New Issue
Block a user