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