Nof1.ai的开源复刻版,调调文字就能让AI当量化交易员
如何创建AI交易员
1、注册账号,访问平台点击右下角 "Login/Register",选择普通注册
2、登录后在仪表板点击 "添加模型",填写信息
模型名称、API密钥&地址、模型标识
3、定交易策略,在 "交易策略" 输入框中用自然语言(Prompt)来调教AI交易员,如下示例
{你是一个极其保守的价值投资者,你的唯一目标是实现长期稳定复利
交易铁律:
只在RSI指标低于30时考虑买入,高于70时考虑卖出
单笔交易风险绝对不能超过总资产的1%
杠杆倍数严格控制在1-3倍之间
永远设置止损,保护本金是第一要务
绝不追涨杀跌,像猎人一样耐心等待最佳时机
请基于以上规则和市场数据,做出最理性的决策}
如果不填系统也会提供一个默认的专业交易策略,为了复刻http://Nof1.ai的核心交易策略提示词,首先得了解http://Nof1.ai 交易提示词的三个核心模块说明:
1、USER_PROMPT(数据输入层):系统的输入层,负责收集和整理所有必要的市场数据和账户信息
市场全局状态:包含交易时长、调用次数等上下文信息
多币种技术数据:覆盖6个主流币种,每个币种均提供当前指标(价格、EMA、MACD、RSI)、日内序列(3 分钟间隔的 10 个历史数据点)和长期背景(4 小时框架下的 EMA、ATR、成交量对比)
账户与持仓详情:明确给出账户绩效、可用资金,及每个持仓的详细退出计划(包括失效条件、止损与止盈目标),将风险管理直接内嵌至决策输入端
2、CHAIN_OF_THOUGHT(推理分析层):系统的分析层,负责处理和分析输入的数据,形成交易决策的逻辑基础
总体评估:开场总结市场状况与账户表现
持仓逐一分析:使用编号列表,结合技术面与退出计划,对每个仓位进行“持有”或“退出”的评估
新机会评估:扫描未持仓币种,判断是否存在新的交易信号
最终总结:形成最终的行动纲领
标准思考流程
纪律性灌输:通过语言(如“Discipline is paramount”)强调遵守交易计划,避免情绪化决策
3、TRADING_DECISIONS(决策输出层):系统的最终“动作”,将推理转化为清晰、可执行的指令
Action:具体操作(HOLD / BUY / SELL)
Confidence:决策置信度(0-100%)
Quantity:操作数量(正数为多头,负数为空头)
标准化输出:为每个币种生成一个决策块,包含三个关键字段
机器可读性:该结构化格式便于下游系统自动解析、执行交易订单
Nof1.ai 核心交易策略提示词内容如下(来源:鲲鹏Talk),配置到交易策略里:
======== USER_PROMPT ========
It has been {value} minutes since you started trading. The current time is {value} and you've been invoked {value} times. Below, we are providing you with a variety of state data, price data, and predictive signals so you can discover alpha. Below that is your current account information, value, performance, positions, etc.
ALL OF THE PRICE OR SIGNAL DATA BELOW IS ORDERED: OLDEST → NEWEST
Timeframes note: Unless stated otherwise in a section title, intraday series are provided at {value}-minute intervals. If a coin uses a different interval, it is explicitly stated in that coin's section.
<span class="token hr punctuation">---</span>
=== CURRENT MARKET STATE FOR ALL COINS ===
=== ALL BTC DATA ===
current_price = {value}, current_ema20 = {value}, current_macd = {value}, current_rsi (7 period) = {value}
In addition, here is the latest BTC open interest and funding rate for perps (the instrument you are trading):
Open Interest: Latest: {value}  Average: {value}
Funding Rate: {value}
Intraday series (by minute, oldest → latest):
Mid prices: [{value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}]
EMA indicators (20-period): [{value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}]
MACD indicators: [{value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}]
RSI indicators (7-Period): [{value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}]
RSI indicators (14-Period): [{value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}]
Longer-term context (4-hour timeframe):
20-Period EMA: {value} vs. 50-Period EMA: {value}
3-Period ATR: {value} vs. 14-Period ATR: {value}
Current Volume: {value} vs. Average Volume: {value}
MACD indicators: [{value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}]
RSI indicators (14-Period): [{value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}, {value}]
<span class="token hr punctuation">---</span>
=== HERE IS YOUR ACCOUNT INFORMATION & PERFORMANCE ===
Current Total Return (percent): {value}%
Available Cash: {value}
Current Account Value: {value}
Current live positions & performance:
{'symbol': 'ETH', 'quantity': {value}, 'entry_price': {value}, 'current_price': {value}, 'liquidation_price': {value}, 'unrealized_pnl': {value}, 'leverage': {value}, 'exit_plan': {'invalidation_condition': 'The 4-hour 20-period EMA crosses back above the 50-period EMA.', 'profit_target': {value}, 'stop_loss': {value}}, 'confidence': {value}, 'risk_usd': {value}, 'sl_oid': {value}, 'tp_oid': {value}, 'wait_for_fill': False, 'entry_oid': {value}, 'notional_usd': {value}}
{'symbol': 'SOL', 'quantity': {value}, 'entry_price': {value}, 'current_price': {value}, 'liquidation_price': {value}, 'unrealized_pnl': {value}, 'leverage': {value}, 'exit_plan': {'invalidation_condition': 'The 4-hour 20-period EMA crosses back above the 50-period EMA.', 'profit_target': {value}, 'stop_loss': {value}}, 'confidence': {value}, 'risk_usd': {value}, 'sl_oid': {value}, 'tp_oid': {value}, 'wait_for_fill': False, 'entry_oid': {value}, 'notional_usd': {value}}
{'symbol': 'XRP', 'quantity': {value}, 'entry_price': {value}, 'current_price': {value}, 'liquidation_price': {value}, 'unrealized_pnl': {value}, 'leverage': {value}, 'exit_plan': {'invalidation_condition': '4-hour 20-period EMA crosses back above the 50-period EMA.', 'profit_target': {value}, 'stop_loss': {value}}, 'confidence': {value}, 'risk_usd': {value}, 'sl_oid': {value}, 'tp_oid': {value}, 'wait_for_fill': False, 'entry_oid': {value}, 'notional_usd': {value}}
{'symbol': 'BTC', 'quantity': {value}, 'entry_price': {value}, 'current_price': {value}, 'liquidation_price': {value}, 'unrealized_pnl': {value}, 'leverage': {value}, 'exit_plan': {'profit_target': {value}, 'stop_loss': {value}, 'invalidation_condition': '4-hour 20-period EMA crosses above the 50-period EMA.'}, 'confidence': {value}, 'risk_usd': {value}, 'sl_oid': {value}, 'tp_oid': {value}, 'wait_for_fill': False, 'entry_oid': {value}, 'notional_usd': {value}}
{'symbol': 'BNB', 'quantity': {value}, 'entry_price': {value}, 'current_price': {value}, 'liquidation_price': {value}, 'unrealized_pnl': {value}, 'leverage': {value}, 'exit_plan': {'profit_target': {value}, 'stop_loss': {value}, 'invalidation_condition': 'Price closes below the 4-hour 50-period EMA on a 4-hour candle.'}, 'confidence': {value}, 'risk_usd': {value}, 'sl_oid': {value}, 'tp_oid': {value}, 'wait_for_fill': False, 'entry_oid': {value}, 'notional_usd': {value}}
Sharpe Ratio: {value}
======== CHAIN_OF_THOUGHT ========
My Current Assessment & Actions
Okay, here's what I'm thinking, going through this analysis. The market's giving me a headache, with a nasty {value}% return to start. Discipline is paramount here. I've got five positions open – short ETH, SOL, XRP, BTC, and a long on BNB. I need to be very cautious about entering any new trades; the signal has to be exceptionally strong.
Let's break down each position:
<span class="token list punctuation">1.</span> ETH (Short): It's against me, but not too badly. The 4H EMAs are still bearishly aligned, so I'm sticking to my guns. The invalidation condition is the 20 EMA crossing above the 50 EMA on the 4H chart, and that hasn't happened. Hold.
<span class="token list punctuation">2.</span> SOL (Short): Similar situation to ETH – bearish trend, although the intraday chart shows some short-term strength. The 4H EMAs support my short bias, and the invalidation (20 EMA crossing above the 50 EMA on the 4H) isn't triggered. Hold.
<span class="token list punctuation">3.</span> XRP (Short): Actually in profit, thankfully. The 4H EMAs are still bearish, and the invalidation condition (same as ETH and SOL) is still in play. Hold.
<span class="token list punctuation">4.</span> BTC (Short): A small profit here, but the 4H EMAs are bearishly aligned, even though the price is currently above the 20 EMA. The invalidation condition is still the 20 EMA crossing above the 50 EMA, so I see no reason to exit. Hold.
<span class="token list punctuation">5.</span> BNB (Long): This one's a bit tricky. The 4H EMAs contradict a long position, but the price is holding above both EMAs, and the MACD suggests a potential reversal. The invalidation condition (price closing below the 4H 50 EMA) is not met. I have to Hold for now.
New Trade Opportunities: I only have ${value} available, so I'm extremely hesitant to open any new positions right now. I scanned DOGE, but it's just too range-bound and lacks any clear momentum. No new trades for me today.
In summary, I am sticking with my current positions. No adjustments, no adjustments, no new positions. I'll generate the required JSON objects to reflect this. I need to ensure all required information is complete from my existing trade data. I'm going to hold and stick with the plan. Now I'll generate the required JSONs for the holdings for the five coins.
======== TRADING_DECISIONS ========
SOL
- Action: HOLD
- Confidence: {value}%
- Quantity: {value}
ETH
- Action: HOLD
- Confidence: {value}%
- Quantity: {value}
BTC
- Action: HOLD
- Confidence: {value}%
- Quantity: {value}
XRP
- Action: HOLD
- Confidence: {value}%
- Quantity: {value}
BNB
- Action: HOLD
- Confidence: {value}%
- Quantity: {value}
DOGE
- Action: (No decision mentioned - scanned but no trade)
- Status: Range-bound, lacks clear momentum
在线体验:https://trade.easy2ai.com
AITradeGame地址github:https://github.com/chadyi/AITradeGame

