{
  "portfolios": [
    {
      "name": "ETH/BTC配对交易策略",
      "code": "crypto_eth_btc_pairs",
      "description": "ETH/BTC比率均值回归优化版：60日均线+连续3天确认，降低频繁切换",
      "symbols": [
        { "symbol": "ETH", "name": "Ethereum" },
        { "symbol": "BTC", "name": "Bitcoin" }
      ],
      "start_date": "2018-01-01",
      "currency": "USD",
      "market": "Crypto",
      "commission": 0.001,
      "update_time": "04:00",
      "strategy_definition": {
        "market_indicators": {
          "indicators": [
            { "code": "ETH" },
            { "code": "BTC" }
          ],
          "transformers": [
            {
              "name": "eth_close",
              "type": "IdentityTransformer",
              "params": {
                "indicator": "ETH",
                "field": "Close"
              }
            },
            {
              "name": "btc_close",
              "type": "IdentityTransformer",
              "params": {
                "indicator": "BTC",
                "field": "Close"
              }
            },
            {
              "name": "eth_ma60",
              "type": "MovingAverageTransformer",
              "params": {
                "indicator": "ETH",
                "window": 60,
                "method": "simple",
                "field": "Close"
              }
            },
            {
              "name": "btc_ma60",
              "type": "MovingAverageTransformer",
              "params": {
                "indicator": "BTC",
                "window": 60,
                "method": "simple",
                "field": "Close"
              }
            }
          ]
        },
        "trade_strategy": {
          "indicators": [],
          "signals": [
            {
              "id": "eth_btc_ratio",
              "type": "Divide",
              "params": {
                "return_calculation": true
              },
              "inputs": [
                { "market": "ETH", "transformer": "eth_close" },
                { "market": "BTC", "transformer": "btc_close" }
              ]
            },
            {
              "id": "eth_btc_ma_ratio",
              "type": "Divide",
              "params": {
                "return_calculation": true
              },
              "inputs": [
                { "market": "ETH", "transformer": "eth_ma60" },
                { "market": "BTC", "transformer": "btc_ma60" }
              ]
            },
            {
              "id": "eth_cheap_raw",
              "type": "LessThan",
              "inputs": [
                { "ref": "eth_btc_ratio" },
                { "ref": "eth_btc_ma_ratio" }
              ]
            },
            {
              "id": "eth_cheap_confirmed",
              "type": "Streak",
              "params": {
                "match_type": "true",
                "min_length": 3
              },
              "inputs": [{ "ref": "eth_cheap_raw" }]
            },
            {
              "id": "pairs_buy",
              "type": "StockBondSwitch",
              "params": {
                "default_to_stock": true
              },
              "inputs": [{ "ref": "eth_cheap_confirmed" }]
            },
            {
              "id": "pairs_sell",
              "type": "Not",
              "inputs": [{ "ref": "pairs_buy" }]
            }
          ],
          "outputs": {
            "buy_signal": "pairs_buy",
            "sell_signal": "pairs_sell",
            "indicators": [
              { "id": "eth_btc_ratio", "output_name": "eth_btc_ratio" },
              { "id": "eth_btc_ma_ratio", "output_name": "ratio_ma" },
              { "id": "eth_cheap_raw", "output_name": "eth_cheap_raw" },
              { "id": "eth_cheap_confirmed", "output_name": "eth_cheap_confirmed" }
            ],
            "market_indicators": [
              {
                "market": "ETH",
                "transformer": "eth_close",
                "output_name": "eth_price"
              },
              {
                "market": "BTC",
                "transformer": "btc_close",
                "output_name": "btc_price"
              }
            ]
          }
        },
        "capital_strategy": {
          "name": "PercentCapitalStrategy",
          "params": {
            "initial_capital": 100000,
            "percents": 95
          }
        }
      }
    }
  ]
}
