优化代码
This commit is contained in:
@@ -164,20 +164,20 @@ async def run_script(
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"清理临时脚本文件失败: {e}")
|
print(f"清理临时脚本文件失败: {e}")
|
||||||
|
|
||||||
@flow(name="Freqtrade Backtesting Flow")
|
@flow(name="run-script", log_prints=True)
|
||||||
def start(
|
def start(
|
||||||
script_url: Optional[str] = None,
|
script_url: Optional[str] = None,
|
||||||
shell_script: Optional[str] = None
|
shell_script: Optional[str] = None
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""
|
"""
|
||||||
Prefect Flow 用于执行 Freqtrade 回测脚本
|
Prefect Flow 用于执行脚本
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
script_url: 用于下载回测脚本的 URL 地址
|
script_url: 用于下载脚本的 URL 地址
|
||||||
shell_script: 直接提供回测脚本内容(优先级高于 script_url)
|
shell_script: 直接提供脚本内容(优先级高于 script_url)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
包含回测结果的字典
|
包含脚本执行结果的字典
|
||||||
"""
|
"""
|
||||||
return run_script(
|
return run_script(
|
||||||
script_url=script_url,
|
script_url=script_url,
|
||||||
@@ -191,7 +191,7 @@ def parse_command_line_args() -> argparse.Namespace:
|
|||||||
Returns:
|
Returns:
|
||||||
命令行参数命名空间
|
命令行参数命名空间
|
||||||
"""
|
"""
|
||||||
parser = argparse.ArgumentParser(description="Freqtrade 回测 Prefect Flow")
|
parser = argparse.ArgumentParser(description="脚本执行 Prefect Flow")
|
||||||
|
|
||||||
# 主参数
|
# 主参数
|
||||||
parser.add_argument("--script-url", type=str, help="用于下载脚本的 URL 地址")
|
parser.add_argument("--script-url", type=str, help="用于下载脚本的 URL 地址")
|
||||||
|
|||||||
Reference in New Issue
Block a user