8
n8n 中文网amn8n.com

使用币安API和Airtable自动追踪加密货币资金费率

高级

这是一个Finance领域的自动化工作流,包含 31 个节点。主要使用 If, Set, Crypto, Airtable, SplitOut 等节点。 使用币安API和Airtable自动追踪加密货币资金费率

前置要求
  • Airtable API Key
  • 可能需要目标 API 的认证凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "6a2a7715680b8313f7cb4676321c5baa46680adfb913072f089f2766f42e43bd",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a3ff8cdd-1dc7-4e0a-96af-ab07ee318ddb",
      "name": "加密货币2",
      "type": "n8n-nodes-base.crypto",
      "position": [
        940,
        -60
      ],
      "parameters": {
        "type": "SHA256",
        "value": "=recvWindow={{20000}}&timestamp={{ $json.timestamp }}",
        "action": "hmac",
        "secret": "pTFNHpnsm4gjz2au6nTCeu9UYgCfFNI1vgVOHLyHQAKUDKwdlVrYuCWXmrAcurYs",
        "dataPropertyName": "secretKey"
      },
      "typeVersion": 1
    },
    {
      "id": "860de117-0305-4c73-917b-f62be016ea4c",
      "name": "编辑字段1",
      "type": "n8n-nodes-base.set",
      "position": [
        760,
        -60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "19bd2a16-442e-416a-a28a-63d4050f4559",
              "name": "timestamp",
              "type": "string",
              "value": "={{$now.format('x')}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "dd682d40-aa6a-4177-8c2a-2f7075e2a43e",
      "name": "编辑字段2",
      "type": "n8n-nodes-base.set",
      "position": [
        1820,
        -60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "918722a0-4a14-4ed4-b18a-b37c401807ec",
              "name": "data",
              "type": "array",
              "value": "={{ \n  $('Aggregate Fees').item.json.data.map(fee => {\n    const position = $('Aggregate Positions').item.json.data.find(pos => pos.symbol === fee.symbol) || {};\n    const token = $('Aggregate Tokens').last().json.data.find(tok => tok.name === fee.symbol) || {};\n\n    return {\n      symbol: fee.symbol,\n      income: fee.income,\n      asset: fee.asset,\n      time: fee.time,\n      tranId: fee.tranId,\n      positionAmt: position.positionAmt || \"0\",\n      markPrice: position.markPrice || \"0.00000000\",\n      liquidationPrice: position.liquidationPrice || \"0\",\n      tokenId: token.id || null  // Get ID from Get Tokens, or null if not found\n    };\n  })\n}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4c6d65ae-1174-495e-8052-f4b998ee001d",
      "name": "分离输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2020,
        -60
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    },
    {
      "id": "a5dd73dc-18fe-400b-beaf-21a83211899f",
      "name": "获取持仓",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        -60
      ],
      "parameters": {
        "url": "https://fapi.binance.com/fapi/v2/positionRisk",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "recvWindow",
              "value": "={{20000}}"
            },
            {
              "name": "timestamp",
              "value": "={{ $('Edit Fields1').item.json.timestamp }}"
            },
            {
              "name": "signature",
              "value": "={{ $json.secretKey }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "nHwfIXHEwCxK80VF",
          "name": "Snezar Loxo"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "491841fe-c173-4644-bf02-d43425f3b10e",
      "name": "汇总持仓",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1320,
        -60
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "90a1818d-a933-4770-997d-2a0692141192",
      "name": "汇总费用",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        580,
        -60
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "39ee87a4-18eb-43f4-8489-ae16797492d6",
      "name": "获取代币",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1480,
        -60
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "app2uc5OOFJdg2weo",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo",
          "cachedResultName": "Binance demo"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tbl8SLbJIGFe12VOR",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo/tbl8SLbJIGFe12VOR",
          "cachedResultName": "Tokens"
        },
        "options": {},
        "operation": "search"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "xZwG0YpqsxpWrzVM",
          "name": "Mark Airtable account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "368b3bac-d0c1-435f-af34-377a893ba0b5",
      "name": "汇总代币",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1660,
        -60
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "e2af8b4d-901f-4115-8704-55ba26e32a3c",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "disabled": true,
      "position": [
        -180,
        -60
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "3 1,9,17 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0795a6bc-1c4a-4a42-a446-8a4b57e8d7d9",
      "name": "加密货币",
      "type": "n8n-nodes-base.crypto",
      "position": [
        40,
        -440
      ],
      "parameters": {
        "type": "SHA256",
        "value": "=symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559",
        "action": "hmac",
        "secret": "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j",
        "dataPropertyName": "signature"
      },
      "typeVersion": 1
    },
    {
      "id": "006b141f-f27f-4099-ba9f-78f6d02a74c6",
      "name": "计划触发器1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -200,
        440
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 4
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "721dfce3-d076-415d-b69c-982e633e4f86",
      "name": "获取代币1",
      "type": "n8n-nodes-base.airtable",
      "position": [
        0,
        440
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "app2uc5OOFJdg2weo",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo",
          "cachedResultName": "Binance demo"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tbl8SLbJIGFe12VOR",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo/tbl8SLbJIGFe12VOR",
          "cachedResultName": "Tokens"
        },
        "options": {},
        "operation": "search"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "xZwG0YpqsxpWrzVM",
          "name": "Mark Airtable account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "edfc1dd2-4ce3-4b42-8abc-6bfe50fc38ec",
      "name": "更新代币价格1",
      "type": "n8n-nodes-base.airtable",
      "position": [
        460,
        420
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "app2uc5OOFJdg2weo",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo",
          "cachedResultName": "Binance demo"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tbl8SLbJIGFe12VOR",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo/tbl8SLbJIGFe12VOR",
          "cachedResultName": "Tokens"
        },
        "columns": {
          "value": {
            "id": "={{ $('Get Tokens1').item.json.id }}",
            "price": "={{ $json.price }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "price",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Funding Statement",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Funding Statement",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "xZwG0YpqsxpWrzVM",
          "name": "Mark Airtable account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4f1d25cc-b79c-407e-a62c-92e4019ef974",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -260,
        300
      ],
      "parameters": {
        "width": 1000,
        "height": 340,
        "content": "### 场景2 - 更新代币价格"
      },
      "typeVersion": 1
    },
    {
      "id": "ba0bc917-c61f-42cd-ac53-1c9028554910",
      "name": "获取价格",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        220,
        440
      ],
      "parameters": {
        "url": "=https://api.binance.com/api/v3/ticker/price?symbol={{ $json.name }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "0dbf2475-0012-4c4c-9b33-900ae3ab8285",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -260,
        -200
      ],
      "parameters": {
        "width": 3080,
        "height": 420,
        "content": "### 场景1 - 添加资金费用"
      },
      "typeVersion": 1
    },
    {
      "id": "28415862-ff31-4b23-83ab-3af1f35b4435",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        2200,
        -60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "46231f93-5e8a-4f8f-8dab-18c70f3d22a2",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.tokenId }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a54f5d41-d240-49dd-8827-8cbe125ec828",
      "name": "创建代币",
      "type": "n8n-nodes-base.airtable",
      "position": [
        2380,
        40
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "app2uc5OOFJdg2weo",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo",
          "cachedResultName": "Binance demo"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tbl8SLbJIGFe12VOR",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo/tbl8SLbJIGFe12VOR",
          "cachedResultName": "Tokens"
        },
        "columns": {
          "value": {
            "name": "={{ $json.symbol }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "price",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Funding Statement",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Funding Statement",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "xZwG0YpqsxpWrzVM",
          "name": "Mark Airtable account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4f4e1eb4-23ea-4f98-8b31-2b2136da15dc",
      "name": "创建对账单",
      "type": "n8n-nodes-base.airtable",
      "position": [
        2440,
        -120
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "app2uc5OOFJdg2weo",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo",
          "cachedResultName": "Binance demo"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblrHB0L42whQF6HM",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo/tblrHB0L42whQF6HM",
          "cachedResultName": "Funding Statement"
        },
        "columns": {
          "value": {
            "time": "={{ $json.time.toDateTime('ms') }}",
            "asset": "={{ $json.asset }}",
            "token": "={{ [$json.tokenId]}}",
            "amount": "={{ $json.income }}",
            "markPrice": "={{ $json.markPrice }}",
            "positionSize": "={{ $json.positionAmt }}",
            "liquidationPrice": "={{ $json.liquidationPrice }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "time",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "token",
              "type": "array",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "token",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "asset",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "asset",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "amount",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "positionSize",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "positionSize",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "annualizedYield",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "annualizedYield",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "liquidationPrice",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "liquidationPrice",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "markPrice",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "markPrice",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "xZwG0YpqsxpWrzVM",
          "name": "Mark Airtable account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ea7f6c61-065f-41a0-87e5-46575612c815",
      "name": "创建对账单1",
      "type": "n8n-nodes-base.airtable",
      "position": [
        2560,
        40
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "app2uc5OOFJdg2weo",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo",
          "cachedResultName": "Binance demo"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblrHB0L42whQF6HM",
          "cachedResultUrl": "https://airtable.com/app2uc5OOFJdg2weo/tblrHB0L42whQF6HM",
          "cachedResultName": "Funding Statement"
        },
        "columns": {
          "value": {
            "time": "={{ $('If').item.json.time.toDateTime('ms') }}",
            "asset": "={{ $('If').item.json.asset }}",
            "token": "={{ [$json.id]}}",
            "amount": "={{ $('If').item.json.income }}",
            "markPrice": "={{ $('If').item.json.markPrice }}",
            "positionSize": "={{ $('If').item.json.positionAmt }}",
            "liquidationPrice": "={{ $('If').item.json.liquidationPrice }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "time",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "token",
              "type": "array",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "token",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "asset",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "asset",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "amount",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "positionSize",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "positionSize",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "annualizedYield",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "annualizedYield",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "liquidationPrice",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "liquidationPrice",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "markPrice",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "markPrice",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "xZwG0YpqsxpWrzVM",
          "name": "Mark Airtable account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c63b2d49-8421-41d4-94d3-331775d15436",
      "name": "加密货币3",
      "type": "n8n-nodes-base.crypto",
      "position": [
        220,
        -60
      ],
      "parameters": {
        "type": "SHA256",
        "value": "=recvWindow={{20000}}&timestamp={{ $json.timestamp }}&incomeType=FUNDING_FEE&startTime={{ $json.startTime }}",
        "action": "hmac",
        "secret": "pTFNHpnsm4gjz2au6nTCeu9UYgCfFNI1vgVOHLyHQAKUDKwdlVrYuCWXmrAcurYs",
        "dataPropertyName": "secretKey"
      },
      "typeVersion": 1
    },
    {
      "id": "501feb0f-231e-4ac6-872e-3b07861a4b45",
      "name": "编辑字段4",
      "type": "n8n-nodes-base.set",
      "position": [
        40,
        -60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "19bd2a16-442e-416a-a28a-63d4050f4559",
              "name": "timestamp",
              "type": "string",
              "value": "={{$now.format('x')}}"
            },
            {
              "id": "8766d7bb-63d7-4c9f-8319-bf5a1083781f",
              "name": "startTime",
              "type": "string",
              "value": "={{ $now.minus(8,'hours').format('x') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "eb371433-5c67-4be2-bf61-c819c085afcf",
      "name": "获取费用2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        400,
        -60
      ],
      "parameters": {
        "url": "https://fapi.binance.com/fapi/v1/income",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "recvWindow",
              "value": "={{20000}}"
            },
            {
              "name": "timestamp",
              "value": "={{ $('Edit Fields4').item.json.timestamp }}"
            },
            {
              "name": "signature",
              "value": "={{ $json.secretKey }}"
            },
            {
              "name": "incomeType",
              "value": "FUNDING_FEE"
            },
            {
              "name": "startTime",
              "value": "={{ $('Edit Fields4').item.json.startTime }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "nHwfIXHEwCxK80VF",
          "name": "Snezar Loxo"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "833d6652-4d44-4a39-8e72-e3fa9a7b5cc8",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        -180
      ],
      "parameters": {
        "color": 5,
        "width": 200,
        "height": 80,
        "content": "### 替换头部认证"
      },
      "typeVersion": 1
    },
    {
      "id": "989a1208-2457-4a85-a409-f00442b629a2",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        120
      ],
      "parameters": {
        "color": 5,
        "width": 160,
        "height": 80,
        "content": "### 替换密钥"
      },
      "typeVersion": 1
    },
    {
      "id": "3c187a46-0760-400a-affa-2e3f1f9499e3",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        120
      ],
      "parameters": {
        "color": 5,
        "width": 160,
        "height": 80,
        "content": "### 替换密钥"
      },
      "typeVersion": 1
    },
    {
      "id": "626481c1-f4a4-44ca-a7f0-32da29dfc0c9",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        -180
      ],
      "parameters": {
        "color": 5,
        "width": 200,
        "height": 80,
        "content": "### 替换头部认证"
      },
      "typeVersion": 1
    },
    {
      "id": "a1c7b2df-c5bd-493a-b63e-6ecad817c7cd",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -260,
        -560
      ],
      "parameters": {
        "width": 780,
        "height": 320,
        "content": "### 示例"
      },
      "typeVersion": 1
    },
    {
      "id": "8ca604f7-214a-40fa-9d9a-4b93a2643d09",
      "name": "币安 - 获取费用",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        -440
      ],
      "parameters": {
        "url": "https://api.binance.com/api/v3/order",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "symbol",
              "value": "=LTCBTC"
            },
            {
              "name": "side",
              "value": "=BUY"
            },
            {
              "name": "signature",
              "value": "={{ $json.signature }}"
            },
            {
              "name": "type",
              "value": "LIMIT"
            },
            {
              "name": "timeInForce",
              "value": "=GTC"
            },
            {
              "name": "quantity",
              "value": "1"
            },
            {
              "name": "price",
              "value": "0.1"
            },
            {
              "name": "recvWindow",
              "value": "5000"
            },
            {
              "name": "timestamp",
              "value": "1499827319559"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "X-MBX-APIKEY",
              "value": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "nHwfIXHEwCxK80VF",
          "name": "Snezar Loxo"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4ca9b631-24e3-4235-b2d2-ccfde43c6e72",
      "name": "设置变量",
      "type": "n8n-nodes-base.set",
      "position": [
        -140,
        -440
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "19bd2a16-442e-416a-a28a-63d4050f4559",
              "name": "timestamp",
              "type": "string",
              "value": "={{$now.format('x')}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "pinData": {
    "Get Fees2": [
      {
        "info": "FUNDING_FEE",
        "time": 1747353601000,
        "asset": "USDT",
        "income": "0.62124647",
        "symbol": "SOLUSDT",
        "tranId": 755481401373412200,
        "tradeId": "",
        "incomeType": "FUNDING_FEE"
      }
    ],
    "Get Positions": [
      {
        "symbol": "SNTUSDT",
        "isolated": false,
        "leverage": "5",
        "notional": "0",
        "markPrice": "0.00000000",
        "entryPrice": "0.0",
        "marginType": "cross",
        "updateTime": 0,
        "adlQuantile": 0,
        "positionAmt": "0",
        "positionSide": "BOTH",
        "breakEvenPrice": "0.0",
        "isolatedMargin": "0.00000000",
        "isolatedWallet": "0",
        "isAutoAddMargin": "false",
        "liquidationPrice": "0",
        "maxNotionalValue": "200000",
        "unRealizedProfit": "0.00000000"
      },
      {
        "symbol": "SUSHIUSDT",
        "isolated": false,
        "leverage": "5",
        "notional": "0",
        "markPrice": "0.00000000",
        "entryPrice": "0.0",
        "marginType": "cross",
        "updateTime": 0,
        "adlQuantile": 0,
        "positionAmt": "0",
        "positionSide": "BOTH",
        "breakEvenPrice": "0.0",
        "isolatedMargin": "0.00000000",
        "isolatedWallet": "0",
        "isAutoAddMargin": "false",
        "liquidationPrice": "0",
        "maxNotionalValue": "1600000",
        "unRealizedProfit": "0.00000000"
      },
      {
        "symbol": "CGPTUSDT",
        "isolated": false,
        "leverage": "5",
        "notional": "0",
        "markPrice": "0.00000000",
        "entryPrice": "0.0",
        "marginType": "cross",
        "updateTime": 0,
        "adlQuantile": 0,
        "positionAmt": "0",
        "positionSide": "BOTH",
        "breakEvenPrice": "0.0",
        "isolatedMargin": "0.00000000",
        "isolatedWallet": "0",
        "isAutoAddMargin": "false",
        "liquidationPrice": "0",
        "maxNotionalValue": "250000",
        "unRealizedProfit": "0.00000000"
      },
      {
        "symbol": "SOLUSDT",
        "isolated": true,
        "leverage": "5",
        "notional": "41118.75",
        "markPrice": "182.75",
        "entryPrice": "176.20",
        "marginType": "isolated",
        "updateTime": 1747353601416,
        "adlQuantile": 3,
        "positionAmt": "225.00",
        "positionSide": "BOTH",
        "breakEvenPrice": "176.25",
        "isolatedMargin": "13688.00",
        "isolatedWallet": "12950.75",
        "isAutoAddMargin": "false",
        "liquidationPrice": "142.98",
        "maxNotionalValue": "80000000",
        "unRealizedProfit": "1471.25"
      }
    ]
  },
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Create Statement",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "Binance - Get Fees",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto2": {
      "main": [
        [
          {
            "node": "Get Positions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto3": {
      "main": [
        [
          {
            "node": "Get Fees2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Fees2": {
      "main": [
        [
          {
            "node": "Aggregate Fees",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Price": {
      "main": [
        [
          {
            "node": "Update Token Prices1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Tokens": {
      "main": [
        [
          {
            "node": "Aggregate Tokens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Tokens1": {
      "main": [
        [
          {
            "node": "Get Price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Token": {
      "main": [
        [
          {
            "node": "Create Statement1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Crypto2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields4": {
      "main": [
        [
          {
            "node": "Crypto3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Positions": {
      "main": [
        [
          {
            "node": "Aggregate Positions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Fees": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Tokens": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "Get Tokens1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Positions": {
      "main": [
        [
          {
            "node": "Get Tokens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 财务

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量31
分类1
节点类型9
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Mark Shcherbakov

Mark Shcherbakov

@lowcodingdev

I am a business analyst with a development background, dedicated to helping small businesses and entrepreneurs leverage cloud services for increased efficiency. My expertise lies in automating manual workflows, integrating data from multiple cloud service providers, creating insightful dashboards, and building custom CRM systems. https://www.linkedin.com/in/marklowcoding/

外部链接
在 n8n.io 查看

分享此工作流