mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-11 23:06:58 +08:00
Fix bugs for get_local_dir
This commit is contained in:
@@ -104,10 +104,9 @@ class Account:
|
|||||||
# if suspend, no new price to be updated, profit is 0
|
# if suspend, no new price to be updated, profit is 0
|
||||||
if trader.check_stock_suspended(code, today):
|
if trader.check_stock_suspended(code, today):
|
||||||
continue
|
continue
|
||||||
else:
|
today_close = trader.get_close(code, today)
|
||||||
today_close = trader.get_close(code, today)
|
profit += (today_close - self.current.position[code]["price"]) * self.current.position[code]["amount"]
|
||||||
profit += (today_close - self.current.position[code]["price"]) * self.current.position[code]["amount"]
|
self.current.update_stock_price(stock_id=code, price=today_close)
|
||||||
self.current.update_stock_price(stock_id=code, price=today_close)
|
|
||||||
self.rtn += profit
|
self.rtn += profit
|
||||||
# update holding day count
|
# update holding day count
|
||||||
self.current.add_count_all()
|
self.current.add_count_all()
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class Operator:
|
|||||||
for user_id, user in um.users.items():
|
for user_id, user in um.users.items():
|
||||||
dates, trade_exchange = prepare(um, trade_date, user_id, exchange_config)
|
dates, trade_exchange = prepare(um, trade_date, user_id, exchange_config)
|
||||||
executor = SimulatorExecutor(trade_exchange=trade_exchange)
|
executor = SimulatorExecutor(trade_exchange=trade_exchange)
|
||||||
if not str(dates[0].date()) == str(pred_date.date()):
|
if str(dates[0].date()) != str(pred_date.date()):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"The account data is not newest! last trading date {}, today {}".format(
|
"The account data is not newest! last trading date {}, today {}".format(
|
||||||
dates[0].date(), trade_date.date()
|
dates[0].date(), trade_date.date()
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ def get_path_list(path):
|
|||||||
if isinstance(path, str):
|
if isinstance(path, str):
|
||||||
return [path]
|
return [path]
|
||||||
else:
|
else:
|
||||||
return [p for p in path]
|
return list(path)
|
||||||
|
|
||||||
|
|
||||||
def sys_config(config, config_path):
|
def sys_config(config, config_path):
|
||||||
|
|||||||
@@ -245,10 +245,10 @@ class MLflowRecorder(Recorder):
|
|||||||
This function will return the directory path of this recorder.
|
This function will return the directory path of this recorder.
|
||||||
"""
|
"""
|
||||||
if self.artifact_uri is not None:
|
if self.artifact_uri is not None:
|
||||||
local_file_prefix = "file:"
|
local_dir_path = Path(self.artifact_uri.lstrip("file:")) / ".."
|
||||||
if self.artifact_uri.startswith(local_file_prefix):
|
local_dir_path = str(local_dir_path.resolve())
|
||||||
xpath = self.artifact_uri.lstrip(local_file_prefix)
|
if os.path.isdir(local_dir_path):
|
||||||
return (Path(xpath) / "..").resolve()
|
return local_dir_path
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("This recorder is not saved in the local file system.")
|
raise RuntimeError("This recorder is not saved in the local file system.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user