chore: Organize workspace structure - move docs, workflows, scripts to subdirectories
Organization: - Created docs/ with setup/, guides/, history/ subdirectories - Created workflows/ with trading/, analytics/, telegram/, archive/ subdirectories - Created scripts/ with docker/, setup/, testing/ subdirectories - Created tests/ for TypeScript test files - Created archive/ for unused reference files Moved files: - 17 documentation files → docs/ - 16 workflow JSON files → workflows/ - 10 shell scripts → scripts/ - 4 test files → tests/ - 5 unused files → archive/ Updated: - README.md with new file structure and documentation paths Deleted: - data/ (empty directory) - screenshots/ (empty directory) Critical files remain in root: - telegram_command_bot.py (active bot - used by Dockerfile) - watch-restart.sh (systemd service dependency) - All Dockerfiles and docker-compose files - All environment files Validation: Containers running (trading-bot-v4, telegram-trade-bot, postgres) API responding (positions endpoint tested) Telegram bot functional (/status command tested) All critical files present in root No code changes - purely organizational. System continues running without interruption. Recovery: git revert HEAD or git reset --hard cleanup-before
This commit is contained in:
297
workflows/archive/n8n-trader-workflow-updated.json
Normal file
297
workflows/archive/n8n-trader-workflow-updated.json
Normal file
@@ -0,0 +1,297 @@
|
||||
{
|
||||
"name": "Trader - Trading Bot v4 Integration",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "3371ad7c-0866-4161-90a4-f251de4aceb8",
|
||||
"options": {}
|
||||
},
|
||||
"id": "683db7ad-2df6-44c7-afaa-d2f40705f268",
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1,
|
||||
"position": [500, 460],
|
||||
"webhookId": "3371ad7c-0866-4161-90a4-f251de4aceb8"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "signal",
|
||||
"stringValue": "={{ $json.body.split('|')[0].trim() }}"
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"stringValue": "={{ $json.body.includes('SOL') ? 'SOL-PERP' : ($json.body.includes('BTC') ? 'BTC-PERP' : ($json.body.includes('ETH') ? 'ETH-PERP' : 'SOL-PERP')) }}"
|
||||
},
|
||||
{
|
||||
"name": "direction",
|
||||
"stringValue": "={{ $json.signal.toLowerCase().includes('buy') || $json.signal.toLowerCase().includes('long') ? 'long' : 'short' }}"
|
||||
},
|
||||
{
|
||||
"name": "timeframe",
|
||||
"stringValue": "5"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "1844fbcb-282b-4b01-9744-b21adda235e9",
|
||||
"name": "Edit Fields",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.2,
|
||||
"position": [700, 460]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "http://trading-bot-v4:3000/api/trading/check-risk",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "=Bearer {{ $env.API_SECRET_KEY }}"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"symbol\": \"{{ $json.symbol }}\",\n \"direction\": \"{{ $json.direction }}\"\n}",
|
||||
"options": {
|
||||
"timeout": 10000
|
||||
}
|
||||
},
|
||||
"id": "check-risk-node",
|
||||
"name": "Check Risk Limits",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.1,
|
||||
"position": [900, 460]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json.allowed }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "risk-check-condition",
|
||||
"name": "Risk Check Passed?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [1100, 460]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "http://trading-bot-v4:3000/api/trading/execute",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "=Bearer {{ $env.API_SECRET_KEY }}"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"symbol\": \"{{ $('Edit Fields').item.json.symbol }}\",\n \"direction\": \"{{ $('Edit Fields').item.json.direction }}\",\n \"timeframe\": \"{{ $('Edit Fields').item.json.timeframe }}\",\n \"signalStrength\": \"strong\"\n}",
|
||||
"options": {
|
||||
"timeout": 30000
|
||||
}
|
||||
},
|
||||
"id": "execute-trade-node",
|
||||
"name": "Execute Trade on Bot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.1,
|
||||
"position": [1300, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json.success }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "trade-success-condition",
|
||||
"name": "Trade Successful?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [1500, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "579304651",
|
||||
"text": "=🟢 TRADE EXECUTED SUCCESSFULLY\n\n{{ $json.signal }}\n\n📊 Symbol: {{ $('Edit Fields').item.json.symbol }}\n📈 Direction: {{ $('Edit Fields').item.json.direction.toUpperCase() }}\n💰 Entry: ${{ $json.entryPrice ? $json.entryPrice.toFixed(4) : 'N/A' }}\n💵 Size: ${{ $json.positionSize ? $json.positionSize.toFixed(2) : 'N/A' }}\n⚡ Leverage: {{ $json.leverage || '10' }}x\n\n🎯 Targets:\n SL: ${{ $json.stopLoss ? $json.stopLoss.toFixed(2) : 'N/A' }} ({{ $json.stopLossPercent || '-1.5' }}%)\n TP1: ${{ $json.takeProfit1 ? $json.takeProfit1.toFixed(2) : 'N/A' }} ({{ $json.tp1Percent || '+0.7' }}%)\n TP2: ${{ $json.takeProfit2 ? $json.takeProfit2.toFixed(2) : 'N/A' }} ({{ $json.tp2Percent || '+1.5' }}%)\n\n⏰ {{ new Date().toLocaleTimeString() }}\n\n✅ Position monitored automatically",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "telegram-success",
|
||||
"name": "Telegram - Success",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [1700, 260],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "579304651",
|
||||
"text": "=🔴 TRADE EXECUTION FAILED\n\n{{ $('Edit Fields').item.json.signal }}\n\n📊 Symbol: {{ $('Edit Fields').item.json.symbol }}\n📈 Direction: {{ $('Edit Fields').item.json.direction.toUpperCase() }}\n\n❌ Error: {{ $json.error || $json.message || 'Unknown error' }}\n\n⏰ {{ new Date().toLocaleTimeString() }}\n\n⚠️ Check bot logs for details",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "telegram-error",
|
||||
"name": "Telegram - Error",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [1700, 460],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "579304651",
|
||||
"text": "=⚠️ TRADE BLOCKED - RISK LIMITS\n\n{{ $('Edit Fields').item.json.signal }}\n\n📊 Symbol: {{ $('Edit Fields').item.json.symbol }}\n📈 Direction: {{ $('Edit Fields').item.json.direction.toUpperCase() }}\n\n🛑 Reason: {{ $('Check Risk Limits').item.json.reason || 'Risk limits exceeded' }}\n\n⏰ {{ new Date().toLocaleTimeString() }}\n\n✅ Trade will be allowed when conditions improve",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "telegram-risk-blocked",
|
||||
"name": "Telegram - Risk Blocked",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [1300, 560],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Edit Fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check Risk Limits",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Risk Limits": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Risk Check Passed?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Risk Check Passed?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Execute Trade on Bot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Risk Blocked",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Execute Trade on Bot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Trade Successful?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Trade Successful?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Success",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Error",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "updated-with-trading-bot-v4",
|
||||
"id": "Bg1iplLiwLdVexG1",
|
||||
"meta": {
|
||||
"instanceId": "e766d4f0b5def8ee8cb8561cd9d2b9ba7733e1907990b6987bca40175f82c379"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
100
workflows/archive/n8n-trader-workflow.json
Normal file
100
workflows/archive/n8n-trader-workflow.json
Normal file
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"name": "Trader",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "3371ad7c-0866-4161-90a4-f251de4aceb8",
|
||||
"options": {}
|
||||
},
|
||||
"id": "683db7ad-2df6-44c7-afaa-d2f40705f268",
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
500,
|
||||
460
|
||||
],
|
||||
"webhookId": "3371ad7c-0866-4161-90a4-f251de4aceb8"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "579304651",
|
||||
"text": "={{ $json.signal.startsWith(\"Buy\") ? \"🟢 \" + $json.signal : \"🔴 \" + $json.signal }}\n",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "e9caf28b-5731-46ba-bb31-b152fde4bae5",
|
||||
"name": "Telegram",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
1300,
|
||||
460
|
||||
],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "signal",
|
||||
"stringValue": "={{ $json.body.split('|')[0].trim() }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "1844fbcb-282b-4b01-9744-b21adda235e9",
|
||||
"name": "Edit Fields",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.2,
|
||||
"position": [
|
||||
860,
|
||||
460
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Edit Fields",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Edit Fields": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "b35ed14e-bd11-4601-a304-6263832f11b4",
|
||||
"id": "Bg1iplLiwLdVexG1",
|
||||
"meta": {
|
||||
"instanceId": "e766d4f0b5def8ee8cb8561cd9d2b9ba7733e1907990b6987bca40175f82c379"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
300
workflows/archive/n8n-workflow-simple.json
Normal file
300
workflows/archive/n8n-workflow-simple.json
Normal file
@@ -0,0 +1,300 @@
|
||||
{
|
||||
"name": "TradingView → Trading Bot v4 (Simplified)",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "tradingview-webhook",
|
||||
"responseMode": "onReceived",
|
||||
"options": {}
|
||||
},
|
||||
"id": "webhook-tradingview",
|
||||
"name": "Webhook - TradingView Alert",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300],
|
||||
"webhookId": "tradingview-webhook"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"functionCode": "// Parse TradingView alert data\nconst body = $input.item.json.body || $input.item.json;\n\n// Extract data from various TradingView formats\nlet symbol = body.symbol || body.ticker || 'SOLUSDT';\nlet action = (body.action || body.signal_type || body.order_action || '').toLowerCase();\nlet timeframe = body.timeframe || body.interval || '5';\nlet price = parseFloat(body.price || body.close || 0);\nlet timestamp = body.timestamp || body.time || new Date().toISOString();\n\n// Normalize symbol (remove exchanges, convert formats)\nsymbol = symbol.replace(/BINANCE:|COINBASE:|FTX:/gi, '');\nsymbol = symbol.replace(/-PERP$/i, '');\nsymbol = symbol.replace(/USDT$/i, 'USD');\nif (symbol === 'SOL') symbol = 'SOLUSDT';\nif (symbol === 'BTC') symbol = 'BTCUSD';\nif (symbol === 'ETH') symbol = 'ETHUSD';\n\n// Normalize action to long/short\nlet direction = 'long';\nif (action.includes('buy') || action.includes('long')) {\n direction = 'long';\n} else if (action.includes('sell') || action.includes('short')) {\n direction = 'short';\n}\n\n// Normalize timeframe (remove 'm' suffix, convert to minutes)\ntimeframe = timeframe.toString().replace(/m$/i, '');\nif (timeframe === '1h') timeframe = '60';\nif (timeframe === '4h') timeframe = '240';\nif (timeframe === '1d') timeframe = '1440';\n\n// Prepare payload for v4 API\nconst apiPayload = {\n symbol: symbol,\n direction: direction,\n timeframe: timeframe,\n signalStrength: body.strength || 'strong',\n signalPrice: price,\n strategy: body.strategy || 'tradingview_alert'\n};\n\nreturn {\n json: {\n rawAlert: body,\n apiPayload: apiPayload,\n parsedData: {\n symbol: symbol,\n direction: direction,\n timeframe: timeframe,\n price: price,\n timestamp: timestamp\n }\n }\n};"
|
||||
},
|
||||
"id": "parse-signal",
|
||||
"name": "Parse TradingView Signal",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [450, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "={{ $env.TRADING_BOT_API_URL }}/api/trading/check-risk",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "=Bearer {{ $env.API_SECRET_KEY }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "symbol",
|
||||
"value": "={{ $json.apiPayload.symbol }}"
|
||||
},
|
||||
{
|
||||
"name": "direction",
|
||||
"value": "={{ $json.apiPayload.direction }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"timeout": 10000
|
||||
}
|
||||
},
|
||||
"id": "check-risk",
|
||||
"name": "Check Risk Limits",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4,
|
||||
"position": [650, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json.allowed }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "risk-check-condition",
|
||||
"name": "Risk Check Passed?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [850, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "={{ $env.TRADING_BOT_API_URL }}/api/trading/execute",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "=Bearer {{ $env.API_SECRET_KEY }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={{ JSON.stringify($('Parse TradingView Signal').item.json.apiPayload) }}",
|
||||
"options": {
|
||||
"timeout": 30000
|
||||
}
|
||||
},
|
||||
"id": "execute-trade",
|
||||
"name": "Execute Trade on Drift",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4,
|
||||
"position": [1050, 200]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"boolean": [
|
||||
{
|
||||
"value1": "={{ $json.success }}",
|
||||
"value2": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "trade-success-condition",
|
||||
"name": "Trade Executed Successfully?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [1250, 200]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"functionCode": "// Format success message for Telegram\nconst trade = $input.item.json.trade || {};\nconst parsedData = $('Parse TradingView Signal').item.json.parsedData;\n\nconst message = `🟢 TRADE EXECUTED\n\n📊 Symbol: ${trade.symbol || parsedData.symbol}\n📈 Direction: ${(trade.direction || parsedData.direction).toUpperCase()}\n💰 Entry Price: $${(trade.entryPrice || parsedData.price).toFixed(4)}\n💵 Position Size: $${(trade.positionSize || trade.notionalValue || 500).toFixed(2)}\n⚡ Leverage: ${trade.leverage || 10}x\n\n🎯 Targets:\n Stop Loss: $${(trade.stopLoss || 0).toFixed(2)} (${trade.stopLossPercent || '-1.5'}%)\n TP1: $${(trade.takeProfit1 || 0).toFixed(2)} (${trade.tp1Percent || '+0.7'}%)\n TP2: $${(trade.takeProfit2 || 0).toFixed(2)} (${trade.tp2Percent || '+1.5'}%)\n\n📊 Slippage: ${(trade.slippage || 0).toFixed(3)}%\n⏰ Time: ${new Date().toLocaleString()}\n\n✅ Position is now being monitored automatically.\nAuto-exit at TP/SL levels.`;\n\nreturn { json: { message } };"
|
||||
},
|
||||
"id": "format-success",
|
||||
"name": "Format Success Message",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [1450, 100]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"functionCode": "// Format error message for Telegram\nconst error = $input.item.json.error || 'Unknown error occurred';\nconst parsedData = $('Parse TradingView Signal').item.json.parsedData;\n\nconst message = `🔴 TRADE EXECUTION FAILED\n\n📊 Symbol: ${parsedData.symbol}\n📈 Direction: ${parsedData.direction.toUpperCase()}\n💰 Price: $${parsedData.price.toFixed(4)}\n\n❌ Error: ${error}\n\n⏰ Time: ${new Date().toLocaleString()}\n\n⚠️ Please check bot logs and Drift account status.`;\n\nreturn { json: { message } };"
|
||||
},
|
||||
"id": "format-error",
|
||||
"name": "Format Error Message",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [1450, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"functionCode": "// Format risk blocked message for Telegram\nconst riskCheck = $('Check Risk Limits').item.json;\nconst parsedData = $('Parse TradingView Signal').item.json.parsedData;\n\nconst message = `⚠️ TRADE BLOCKED - RISK LIMITS\n\n📊 Symbol: ${parsedData.symbol}\n📈 Direction: ${parsedData.direction.toUpperCase()}\n💰 Price: $${parsedData.price.toFixed(4)}\n\n🛑 Reason: ${riskCheck.reason || 'Risk limits exceeded'}\n\n📈 Current Stats:\n Trades Today: ${riskCheck.stats?.tradesToday || 0}\n Daily P&L: ${riskCheck.stats?.dailyPnl || 0}%\n Last Trade: ${riskCheck.stats?.lastTradeMinutesAgo || 0} min ago\n\n⏰ Time: ${new Date().toLocaleString()}\n\n✅ Trade will be allowed when risk conditions improve.`;\n\nreturn { json: { message } };"
|
||||
},
|
||||
"id": "format-risk-blocked",
|
||||
"name": "Format Risk Blocked Message",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [1050, 400]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
|
||||
"text": "={{ $json.message }}",
|
||||
"additionalFields": {
|
||||
"parse_mode": "Markdown"
|
||||
}
|
||||
},
|
||||
"id": "telegram-notification",
|
||||
"name": "Telegram - Send Notification",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1,
|
||||
"position": [1650, 200],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "1",
|
||||
"name": "Telegram Bot"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Webhook - TradingView Alert": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Parse TradingView Signal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Parse TradingView Signal": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check Risk Limits",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Risk Limits": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Risk Check Passed?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Risk Check Passed?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Execute Trade on Drift",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Format Risk Blocked Message",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Execute Trade on Drift": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Trade Executed Successfully?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Trade Executed Successfully?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format Success Message",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Format Error Message",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Success Message": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Send Notification",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Error Message": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Send Notification",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Risk Blocked Message": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram - Send Notification",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"staticData": null,
|
||||
"tags": [],
|
||||
"triggerCount": 1,
|
||||
"updatedAt": "2025-10-23T00:00:00.000Z",
|
||||
"versionId": "1"
|
||||
}
|
||||
161
workflows/archive/telegram-listener-simple.json
Normal file
161
workflows/archive/telegram-listener-simple.json
Normal file
@@ -0,0 +1,161 @@
|
||||
{
|
||||
"name": "ADD THIS TO MONEY MACHINE - Manual Trade Listener",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"triggerAtMinute": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "schedule-check-telegram",
|
||||
"name": "Check Every 10 Seconds",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-1040,
|
||||
280
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "getMany",
|
||||
"chatId": "579304651",
|
||||
"returnAll": false,
|
||||
"limit": 5
|
||||
},
|
||||
"id": "get-recent-messages",
|
||||
"name": "Get Recent Messages",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-860,
|
||||
280
|
||||
],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.text }}",
|
||||
"operation": "regex",
|
||||
"value2": "^(buy|sell|long|short)\\s+(SOL|BTC|ETH)"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "filter-commands",
|
||||
"name": "Is Trade Command?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-680,
|
||||
280
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "symbol",
|
||||
"stringValue": "={{ $json.text.match(/\\b(SOL|BTC|ETH)\\b/i)[0].toUpperCase() }}-PERP"
|
||||
},
|
||||
{
|
||||
"name": "direction",
|
||||
"stringValue": "={{ $json.text.match(/^(sell|short)\\b/i) ? 'short' : 'long' }}"
|
||||
},
|
||||
{
|
||||
"name": "timeframe",
|
||||
"stringValue": "5"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "parse-trade",
|
||||
"name": "Parse Trade",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.2,
|
||||
"position": [
|
||||
-500,
|
||||
280
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={{ $json }}"
|
||||
},
|
||||
"id": "output-to-check-risk",
|
||||
"name": "➡️ Merge with Check Risk",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.3,
|
||||
"position": [
|
||||
-320,
|
||||
280
|
||||
],
|
||||
"notes": "Connect this to the SAME point where your TradingView webhook connects (before Check Risk node)"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Check Every 10 Seconds": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Recent Messages",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Recent Messages": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Is Trade Command?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Is Trade Command?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Parse Trade",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Parse Trade": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "➡️ Merge with Check Risk",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
}
|
||||
}
|
||||
219
workflows/archive/telegram-n8n-listener.json
Normal file
219
workflows/archive/telegram-n8n-listener.json
Normal file
@@ -0,0 +1,219 @@
|
||||
{
|
||||
"name": "Telegram Manual Trade - ADD TO MONEY MACHINE",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "telegram-trade",
|
||||
"responseMode": "responseNode",
|
||||
"options": {}
|
||||
},
|
||||
"id": "webhook",
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1.1,
|
||||
"position": [200, 300],
|
||||
"webhookId": "telegram-trade-webhook"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.body.message || $json.body.text || '' }}",
|
||||
"operation": "regex",
|
||||
"value2": "^(buy|sell|long|short)\\s+(sol|btc|eth)"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "filter-trades",
|
||||
"name": "Is Trade Command?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [400, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "symbol",
|
||||
"value": "={{ ($json.body.message || $json.body.text).match(/\\b(SOL|BTC|ETH)\\b/i)[0].toUpperCase() }}-PERP"
|
||||
},
|
||||
{
|
||||
"name": "direction",
|
||||
"value": "={{ ($json.body.message || $json.body.text).match(/^(sell|short)\\b/i) ? 'short' : 'long' }}"
|
||||
},
|
||||
{
|
||||
"name": "timeframe",
|
||||
"value": "5"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "parse-command",
|
||||
"name": "Parse Trade",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "json",
|
||||
"responseBody": "={{ { status: 'received', symbol: $json.symbol, direction: $json.direction } }}"
|
||||
},
|
||||
"id": "webhook-response",
|
||||
"name": "Webhook Response",
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 450]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "579304651",
|
||||
"text": "🤖 Manual Trade\n\n📊 {{ $json.symbol }}\n{{ $json.direction === 'long' ? '📈' : '📉' }} {{ $json.direction.toUpperCase() }}\n⏰ {{ $now.format('HH:mm:ss') }}\n\n✅ Executing...",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "confirm",
|
||||
"name": "Send Confirmation",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [800, 300],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "output",
|
||||
"name": "➡️ Connect to Check Risk",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1000, 300],
|
||||
"notes": "Connect this to your Money Machine's Check Risk node"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Webhook": {
|
||||
"main": [[
|
||||
{"node": "Is Trade Command?", "type": "main", "index": 0}
|
||||
]]
|
||||
},
|
||||
"Is Trade Command?": {
|
||||
"main": [[
|
||||
{"node": "Parse Trade", "type": "main", "index": 0}
|
||||
]]
|
||||
},
|
||||
"Parse Trade": {
|
||||
"main": [[
|
||||
{"node": "Webhook Response", "type": "main", "index": 0},
|
||||
{"node": "Send Confirmation", "type": "main", "index": 0}
|
||||
]]
|
||||
},
|
||||
"Send Confirmation": {
|
||||
"main": [[
|
||||
{"node": "➡️ Connect to Check Risk", "type": "main", "index": 0}
|
||||
]]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"versionId": "telegram-webhook-v2"
|
||||
}
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.message.text }}",
|
||||
"operation": "regex",
|
||||
"value2": "^(buy|sell|long|short)\\s+(sol|btc|eth)$"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "filter-trades",
|
||||
"name": "Is Trade Command?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [400, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "symbol",
|
||||
"value": "={{ $json.message.text.match(/\\b(SOL|BTC|ETH)\\b/i)[0].toUpperCase() }}-PERP"
|
||||
},
|
||||
{
|
||||
"name": "direction",
|
||||
"value": "={{ $json.message.text.match(/^(sell|short)\\b/i) ? 'short' : 'long' }}"
|
||||
},
|
||||
{
|
||||
"name": "timeframe",
|
||||
"value": "5"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "parse-command",
|
||||
"name": "Parse Trade",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 1,
|
||||
"position": [600, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "579304651",
|
||||
"text": "🤖 Manual Trade\n\n📊 {{ $json.symbol }}\n{{ $json.direction === 'long' ? '📈' : '📉' }} {{ $json.direction.toUpperCase() }}\n⏰ {{ $now.format('HH:mm:ss') }}\n\n✅ Executing...",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "confirm",
|
||||
"name": "Send Confirmation",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [800, 300],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "output",
|
||||
"name": "➡️ Connect to Check Risk",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1000, 300],
|
||||
"notes": "Connect this to your Money Machine's Check Risk node"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Telegram Messages": {
|
||||
"main": [[{"node": "Is Trade Command?", "type": "main", "index": 0}]]
|
||||
},
|
||||
"Is Trade Command?": {
|
||||
"main": [[{"node": "Parse Trade", "type": "main", "index": 0}]]
|
||||
},
|
||||
"Parse Trade": {
|
||||
"main": [[{"node": "Send Confirmation", "type": "main", "index": 0}]]
|
||||
},
|
||||
"Send Confirmation": {
|
||||
"main": [[{"node": "➡️ Connect to Check Risk", "type": "main", "index": 0}]]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"versionId": "telegram-n8n-listener-v1"
|
||||
}
|
||||
178
workflows/archive/telegram-polling-addon.json
Normal file
178
workflows/archive/telegram-polling-addon.json
Normal file
@@ -0,0 +1,178 @@
|
||||
{
|
||||
"name": "Telegram Manual Trade (Polling) - Import to Money Machine",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "message",
|
||||
"operation": "get",
|
||||
"chatId": "579304651",
|
||||
"returnAll": false,
|
||||
"limit": 1,
|
||||
"options": {}
|
||||
},
|
||||
"id": "telegram-poll-messages",
|
||||
"name": "Poll Telegram Messages",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-1020,
|
||||
460
|
||||
],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.text }}",
|
||||
"operation": "regex",
|
||||
"value2": "\\b(buy|sell|long|short)\\b"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "filter-trade-commands",
|
||||
"name": "Filter Trade Commands",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-840,
|
||||
460
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "rawMessage",
|
||||
"stringValue": "={{ $json.text }}"
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"stringValue": "={{ $json.text.match(/\\b(SOL|BTC|ETH)\\b/i) ? $json.text.match(/\\b(SOL|BTC|ETH)\\b/i)[0].toUpperCase() + '-PERP' : 'SOL-PERP' }}"
|
||||
},
|
||||
{
|
||||
"name": "direction",
|
||||
"stringValue": "={{ $json.text.match(/\\b(sell|short)\\b/i) ? 'short' : 'long' }}"
|
||||
},
|
||||
{
|
||||
"name": "timeframe",
|
||||
"stringValue": "5"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "parse-command",
|
||||
"name": "Parse Trade Command",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.2,
|
||||
"position": [
|
||||
-660,
|
||||
460
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "579304651",
|
||||
"text": "🤖 Manual trade:\n\n📊 {{ $json.symbol }}\n{{ $json.direction === 'long' ? '📈' : '📉' }} {{ $json.direction.toUpperCase() }}\n⏰ {{ $now.toFormat('HH:mm:ss') }}\n\n⏳ Processing...",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "send-ack",
|
||||
"name": "Send Acknowledgment",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-480,
|
||||
460
|
||||
],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={{ $json }}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "output-node",
|
||||
"name": "➡️ Connect to Check Risk",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.3,
|
||||
"position": [
|
||||
-300,
|
||||
460
|
||||
],
|
||||
"notes": "Connect this node's output to Money Machine's Check Risk node"
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Poll Telegram Messages": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Filter Trade Commands",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Filter Trade Commands": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Parse Trade Command",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Parse Trade Command": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Acknowledgment",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send Acknowledgment": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "➡️ Connect to Check Risk",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "telegram-polling-v1",
|
||||
"meta": {
|
||||
"instanceId": "e766d4f0b5def8ee8cb8561cd9d2b9ba7733e1907990b6987bca40175f82c379"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
138
workflows/archive/telegram-trigger-addon.json
Normal file
138
workflows/archive/telegram-trigger-addon.json
Normal file
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"name": "Telegram Trade Trigger (Import to Money Machine)",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "manual-telegram-trade",
|
||||
"options": {}
|
||||
},
|
||||
"id": "webhook-telegram-manual",
|
||||
"name": "Telegram Command Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-840,
|
||||
460
|
||||
],
|
||||
"webhookId": "manual-telegram-trade-webhook"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fields": {
|
||||
"values": [
|
||||
{
|
||||
"name": "rawMessage",
|
||||
"stringValue": "={{ $json.body.message || $json.body.text || $json.body }}"
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"stringValue": "={{ ($json.body.message || $json.body.text || $json.body).toString().match(/\\b(SOL|BTC|ETH)\\b/i) ? ($json.body.message || $json.body.text || $json.body).toString().match(/\\b(SOL|BTC|ETH)\\b/i)[0].toUpperCase() + '-PERP' : 'SOL-PERP' }}"
|
||||
},
|
||||
{
|
||||
"name": "direction",
|
||||
"stringValue": "={{ ($json.body.message || $json.body.text || $json.body).toString().match(/\\b(sell|short)\\b/i) ? 'short' : 'long' }}"
|
||||
},
|
||||
{
|
||||
"name": "timeframe",
|
||||
"stringValue": "5"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "parse-telegram-manual",
|
||||
"name": "Parse Manual Command",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.2,
|
||||
"position": [
|
||||
-660,
|
||||
460
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "579304651",
|
||||
"text": "🤖 Manual trade command:\n\n📊 {{ $json.symbol }}\n📈 {{ $json.direction.toUpperCase() }}\n⏰ {{ $now.toFormat('HH:mm') }}\n\n⏳ Processing...",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "ack-manual-command",
|
||||
"name": "Send Acknowledgment",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
-480,
|
||||
460
|
||||
],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
"id": "Csk5cg4HtaSqP5jJ",
|
||||
"name": "Telegram account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"mode": "raw",
|
||||
"jsonOutput": "={{ $json }}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "ready-for-check-risk",
|
||||
"name": "➡️ Connect to Check Risk",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3.3,
|
||||
"position": [
|
||||
-300,
|
||||
460
|
||||
],
|
||||
"notes": "Connect this output to the 'Check Risk' node in Money Machine"
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Telegram Command Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Parse Manual Command",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Parse Manual Command": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Acknowledgment",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Send Acknowledgment": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "➡️ Connect to Check Risk",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "telegram-webhook-v1",
|
||||
"meta": {
|
||||
"instanceId": "e766d4f0b5def8ee8cb8561cd9d2b9ba7733e1907990b6987bca40175f82c379"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
Reference in New Issue
Block a user