{
  "name": "M1-Market-Amount (1m + 15:00\u8865\u70b9)",
  "nodes": [
    {
      "id": "trigger-1m",
      "name": "1\u5206\u949f\u89e6\u53d1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "* 9-11 * * 1-5"
            },
            {
              "field": "cronExpression",
              "expression": "* 13-14 * * 1-5"
            }
          ]
        }
      }
    },
    {
      "id": "trigger-close",
      "name": "15:00\u8865\u70b9\u89e6\u53d1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 15 * * 1-5"
            }
          ]
        }
      }
    },
    {
      "id": "manual",
      "name": "\u624b\u52a8\u89e6\u53d1",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        320
      ]
    },
    {
      "id": "params-normal",
      "name": "\u53c2\u6570(\u5e38\u89c4)",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.2,
      "position": [
        220,
        0
      ],
      "parameters": {
        "values": {
          "boolean": [
            {
              "name": "force",
              "value": false
            }
          ]
        }
      }
    },
    {
      "id": "params-close",
      "name": "\u53c2\u6570(\u6536\u76d8\u8865\u70b9)",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.2,
      "position": [
        220,
        160
      ],
      "parameters": {
        "values": {
          "boolean": [
            {
              "name": "force",
              "value": true
            }
          ]
        }
      }
    },
    {
      "id": "params-manual",
      "name": "\u53c2\u6570(\u624b\u52a8)",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.2,
      "position": [
        220,
        320
      ],
      "parameters": {
        "values": {
          "boolean": [
            {
              "name": "force",
              "value": true
            }
          ]
        }
      }
    },
    {
      "id": "http",
      "name": "\u8c03\u7528\u672c\u5730\u811a\u672c",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        450,
        160
      ],
      "parameters": {
        "method": "POST",
        "url": "http://host.docker.internal:8787/api/m1/run",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"script\": \"m1_market_amount.py\",\n  \"day\": \"{{ $today.toFormat('yyyy-MM-dd') }}\",\n  \"force\": {{ $json.force ? 'true' : 'false' }}\n}",
        "options": {}
      }
    },
    {
      "id": "parse",
      "name": "\u8f93\u51fa\u65e5\u5fd7",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        650,
        160
      ],
      "parameters": {
        "jsCode": "return $input.all().map(item => {\n  let raw = item.json.stdout ? item.json.stdout.join('\\n') : '';\n  let summary = `M1-Market-Amount \u274c \u672a\u77e5\u9519\u8bef`;\n  if (raw.includes('\u23ed\ufe0f \u975e\u4ea4\u6613\u65f6\u6bb5')) {\n    summary = `M1-Market-Amount \u23ed\ufe0f \u8df3\u8fc7: \u975e\u4ea4\u6613\u65f6\u6bb5`;\n  } else if (raw.includes('\u2705 \u6210\u529f\uff01')) {\n    const match = raw.match(/\u2705 \u6210\u529f\uff01(.*)/);\n    if (match) {\n      summary = `M1-Market-Amount \u2705\\n${match[1]}`;\n    }\n  } else if (raw.includes('\u274c')) {\n    const match = raw.match(/\u274c (.*)/);\n    if (match) summary = `M1-Market-Amount \u274c \u5931\u8d25: ${match[1]}`;\n  }\n  return { json: { summary } };\n});"
      }
    }
  ],
  "connections": {
    "1\u5206\u949f\u89e6\u53d1": {
      "main": [
        [
          {
            "node": "\u53c2\u6570(\u5e38\u89c4)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "15:00\u8865\u70b9\u89e6\u53d1": {
      "main": [
        [
          {
            "node": "\u53c2\u6570(\u6536\u76d8\u8865\u70b9)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u624b\u52a8\u89e6\u53d1": {
      "main": [
        [
          {
            "node": "\u53c2\u6570(\u624b\u52a8)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u53c2\u6570(\u5e38\u89c4)": {
      "main": [
        [
          {
            "node": "\u8c03\u7528\u672c\u5730\u811a\u672c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u53c2\u6570(\u6536\u76d8\u8865\u70b9)": {
      "main": [
        [
          {
            "node": "\u8c03\u7528\u672c\u5730\u811a\u672c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u53c2\u6570(\u624b\u52a8)": {
      "main": [
        [
          {
            "node": "\u8c03\u7528\u672c\u5730\u811a\u672c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u8c03\u7528\u672c\u5730\u811a\u672c": {
      "main": [
        [
          {
            "node": "\u8f93\u51fa\u65e5\u5fd7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}