{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "bb235e4d-8151-47b0-8e7a-cc45d650b65b",
      "name": "Main Sticky",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        -192
      ],
      "parameters": {
        "width": 500,
        "height": 404,
        "content": "## \ud83d\ude80 High-Yield Crypto Monitor\n\n## How it works\nThis workflow automatically monitors Binance Flexible Earn products daily. It authenticates securely, fetches the latest rates, identifies the top 15 highest APY assets, calculates potential daily earnings based on a simulation ($10k), and emails you a report.\n\n## Setup steps\n1. Double-click the **'Set Credentials'** node and enter your Binance API Key and Secret.\n2. Configure the **'Send Email'** node with your Gmail credentials and recipient address.\n3. (Optional) Adjust the investment simulation amount in the **'Filter & Analyze'** node code."
      },
      "typeVersion": 1
    },
    {
      "id": "61ccefd1-f34d-4c06-9bc0-42a56f9111c8",
      "name": "Auth Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 1000,
        "height": 240,
        "content": "## \ud83d\udd10 Authentication & API Fetch\nGenerates the required timestamp and HMAC-SHA256 signature to securely fetch live data from the Binance API."
      },
      "typeVersion": 1
    },
    {
      "id": "5ca9e130-6ee4-4314-bfcf-49db01b0fc7e",
      "name": "Processing Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 240,
        "content": "## \ud83e\uddf9 Data Processing\nSplits the raw data list, selects relevant fields, sorts by APY (descending), and limits the results to the top 15 assets."
      },
      "typeVersion": 1
    },
    {
      "id": "3e0611d3-7abb-45dc-9dc1-31e866582c89",
      "name": "Reporting Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 240,
        "content": "## \ud83d\udcca Analysis & Report\nCalculates estimated daily earnings and generates an HTML email report."
      },
      "typeVersion": 1
    },
    {
      "id": "1bc178b5-f381-4f60-8320-7515a84968e1",
      "name": "Daily Trigger1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -144,
        384
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "eda938c1-a90c-494e-a889-94f0e27b0793",
      "name": "Prepare Data1",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        384
      ],
      "parameters": {
        "jsCode": "const timestamp = Date.now();\n\n// We must define the query string EXACTLY as it will be signed\n// Order matters: size first, then timestamp\nconst queryString = `size=100&timestamp=${timestamp}`;\n\nreturn {\n  timestamp: timestamp,\n  queryString: queryString\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "87bdc101-2e0e-47f3-b71e-399388f4d5b1",
      "name": "Sign Request1",
      "type": "n8n-nodes-base.crypto",
      "position": [
        512,
        384
      ],
      "parameters": {
        "type": "SHA256",
        "value": "={{ $('Prepare Data1').item.json.queryString }}",
        "action": "hmac",
        "secret": "={{ $json.SECRET_KEY }}",
        "dataPropertyName": "signature"
      },
      "typeVersion": 1
    },
    {
      "id": "ff849ed1-165c-4f8c-8e09-063a882db350",
      "name": "Get Earn Rates1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        384
      ],
      "parameters": {
        "url": "https://api.binance.com/sapi/v1/simple-earn/flexible/list",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "size",
              "value": "100"
            },
            {
              "name": "timestamp",
              "value": "={{ $('Prepare Data1').item.json.timestamp }}"
            },
            {
              "name": "signature",
              "value": "={{ $json.signature }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "X-MBX-APIKEY",
              "value": "={{ $json.API_KEY }}"
            }
          ]
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "f91ee167-64c7-4b61-be77-05a833aa2bc8",
      "name": "Filter & Analyze1",
      "type": "n8n-nodes-base.code",
      "position": [
        1776,
        384
      ],
      "parameters": {
        "jsCode": "const capital = 10000; // Simulation amount\nconst results = [];\n\nfor (const product of $input.all()) {\n  const apy = parseFloat(product.json.latestAnnualPercentageRate);\n  results.push({\n    asset: product.json.asset,\n    apy_percent: (apy * 100).toFixed(2) + '%',\n    daily_income: '$' + (capital * apy / 365).toFixed(2)\n  });\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "7d1e0b5c-7596-4320-8103-baee2823db5c",
      "name": "Send Email1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1984,
        384
      ],
      "parameters": {
        "message": "=<h3>Daily Yield Report</h3>\n<ul>\n{{ $input.all().map(i => `\n  <li>\n    <b>${i.json.asset}</b>: ${i.json.apy_percent} APY \n    (Est. ${i.json.daily_income}/day on $10k)\n  </li>\n`).join('') }}\n</ul>",
        "options": {},
        "subject": "Binance Yield Update"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 2.1
    },
    {
      "id": "2273e447-2d1a-4f98-9187-9e93a2fb9ca9",
      "name": "Split Out1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        944,
        384
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "rows"
      },
      "typeVersion": 1
    },
    {
      "id": "1a6fb368-afd2-49c4-9087-91ba4d18bcbf",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        1152,
        384
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cbaefc98-8c09-4f2f-9e36-af1b337f1187",
              "name": "asset",
              "type": "string",
              "value": "={{ $json.asset }}"
            },
            {
              "id": "734e417f-dba7-45d4-8b7f-512da6e1f4d2",
              "name": "latestAnnualPercentageRate",
              "type": "string",
              "value": "={{ $json.latestAnnualPercentageRate }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "be223424-856e-4889-bcdc-8e1a723ecb29",
      "name": "Sort1",
      "type": "n8n-nodes-base.sort",
      "position": [
        1360,
        384
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "order": "descending",
              "fieldName": "latestAnnualPercentageRate"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0ad133c8-3586-490b-8f70-cc665f3c7f84",
      "name": "Limit1",
      "type": "n8n-nodes-base.limit",
      "position": [
        1568,
        384
      ],
      "parameters": {
        "maxItems": 15
      },
      "typeVersion": 1
    },
    {
      "id": "16b18467-73ea-4d50-87df-43e2824b243c",
      "name": "Set Credentials1",
      "type": "n8n-nodes-base.set",
      "position": [
        320,
        384
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "af766b1a-bb45-49cc-a48a-8ee5505d9069",
              "name": "API_KEY",
              "type": "string",
              "value": "YOUR_BINANCE_API_KEY"
            },
            {
              "id": "1a308c05-91e0-4537-a257-ff46dfae4057",
              "name": "SECRET_KEY",
              "type": "string",
              "value": "YOUR_BINANCE_SECRET_KEY"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "connections": {
    "Sort1": {
      "main": [
        [
          {
            "node": "Limit1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit1": {
      "main": [
        [
          {
            "node": "Filter & Analyze1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out1": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Sort1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Data1": {
      "main": [
        [
          {
            "node": "Set Credentials1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sign Request1": {
      "main": [
        [
          {
            "node": "Get Earn Rates1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Trigger1": {
      "main": [
        [
          {
            "node": "Prepare Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Earn Rates1": {
      "main": [
        [
          {
            "node": "Split Out1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Credentials1": {
      "main": [
        [
          {
            "node": "Sign Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter & Analyze1": {
      "main": [
        [
          {
            "node": "Send Email1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}