用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tradingstrategy-ai/trade-executor --skill notebook-to-strategy命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | notebook-to-strategy |
| description | Transfer code from a backtesting Jupyter notebook to a Trade Executor strategy module |
Transfer code from a backtesting Jupyter notebook to a Trade Executor strategy module.
.ipynb) containing the strategy backtest.py) that will be created or updatedBoth of these follow similar, but not same, structure as defined in .claude/skills/notebook-to-strategy/strategy-module-description.md.
The skill maps notebook sections to strategy module sections as defined in strategy-module-description.md.
Parameters classcreate_trading_universe() functiondecide_trades() function@indicators.define()create_indicators() wrapper functioncreate_charts() functionrequired_live_history parameter matches the indicators used in in the decide_trades(), so that live indicator calculations will have enough data + marginAfter updating the strategy module, run a backtest to verify it works:
source .local-test.env && poetry run trade-executor \
backtest \
--render=charts \
--strategy-file <strategy_module_path>
Unless the script prints "All ok" at the end of it, it is a failure.
After running the backtest, the CLI command outputs three generated files like:
From the HTML file, extract Performance and risk metrics¶ table, format is so that you can display it inline in the chat, and print back test results of top 15 rows.
Get the top 15 row results from the step above.
In the doc string header comment of the strategy module, includethe
client = Client.create_jupyter_client()) is excludedrun_backtest_inline()) is excluded from the strategy moduletrading_strategy_engine_version constant is preserved or set appropriately.
Use the default "0.5"Some example functions how to implement functions in the trading strategy module.
def create_indicators(
timestamp: datetime.datetime,
parameters: StrategyParameters,
strategy_universe: TradingStrategyUniverse,
execution_context: ExecutionContext
):
return indicators.create_indicators(
timestamp=timestamp,
parameters=parameters,
strategy_universe=strategy_universe,
execution_context=execution_context,
)
# Define charts we use in backtesting and live trading
def create_charts(
timestamp: datetime.datetime | None,
parameters: StrategyParameters,
strategy_universe: TradingStrategyUniverse,
execution_context: ExecutionContext,
) -> ChartRegistry:
# Code from notebook goes here
pass