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": []
|
||||
}
|
||||
Reference in New Issue
Block a user