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:
22
scripts/testing/send_trade.sh
Executable file
22
scripts/testing/send_trade.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Quick script to trigger manual trades via n8n webhook
|
||||
# Usage: ./send_trade.sh "buy SOL"
|
||||
# ./send_trade.sh "sell BTC"
|
||||
|
||||
WEBHOOK_URL="https://YOUR_N8N_URL/webhook/manual-trade"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 \"buy SOL\" or \"sell BTC\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COMMAND="$1"
|
||||
|
||||
echo "📤 Sending command: $COMMAND"
|
||||
|
||||
curl -X POST "$WEBHOOK_URL" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"text\": \"$COMMAND\"}"
|
||||
|
||||
echo ""
|
||||
echo "✅ Command sent!"
|
||||
73
scripts/testing/test-exit-orders.sh
Executable file
73
scripts/testing/test-exit-orders.sh
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
# Test script to execute a tiny trade and verify exit orders are placed on-chain
|
||||
|
||||
echo "🧪 Testing exit order placement with tiny position..."
|
||||
echo "📊 Current settings:"
|
||||
echo " Position: \$10 (base)"
|
||||
echo " Leverage: 5x"
|
||||
echo " Notional: \$50"
|
||||
echo ""
|
||||
|
||||
# API endpoint and credentials
|
||||
API_URL="http://localhost:3001/api/trading/execute"
|
||||
API_KEY="2a344f0149442c857fb56c038c0c7d1b113883b830bec792c76f1e0efa15d6bb"
|
||||
|
||||
# Trade request payload
|
||||
PAYLOAD='{
|
||||
"symbol": "SOLUSDT",
|
||||
"direction": "long",
|
||||
"timeframe": "5",
|
||||
"signalStrength": "strong"
|
||||
}'
|
||||
|
||||
echo "🚀 Sending trade execution request..."
|
||||
echo ""
|
||||
|
||||
# Execute the request
|
||||
RESPONSE=$(curl -s -X POST "$API_URL" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $API_KEY" \
|
||||
-d "$PAYLOAD")
|
||||
|
||||
echo "📨 Response:"
|
||||
echo "$RESPONSE" | jq '.' 2>/dev/null || echo "$RESPONSE"
|
||||
echo ""
|
||||
|
||||
# Check if successful
|
||||
if echo "$RESPONSE" | jq -e '.success' > /dev/null 2>&1; then
|
||||
echo "✅ Trade executed successfully!"
|
||||
|
||||
# Extract signatures
|
||||
POSITION_ID=$(echo "$RESPONSE" | jq -r '.positionId')
|
||||
EXIT_SIGS=$(echo "$RESPONSE" | jq -r '.exitOrderSignatures[]?' 2>/dev/null)
|
||||
|
||||
echo ""
|
||||
echo "📝 Transaction details:"
|
||||
echo " Entry TX: $POSITION_ID"
|
||||
|
||||
if [ -n "$EXIT_SIGS" ]; then
|
||||
echo " Exit orders placed:"
|
||||
echo "$EXIT_SIGS" | while read -r sig; do
|
||||
echo " - $sig"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "🔍 Verify on Drift:"
|
||||
echo " https://app.drift.trade/"
|
||||
echo ""
|
||||
echo "🔍 Verify on Solscan:"
|
||||
echo "$EXIT_SIGS" | while read -r sig; do
|
||||
echo " https://solscan.io/tx/$sig"
|
||||
done
|
||||
else
|
||||
echo " ⚠️ No exit order signatures in response"
|
||||
fi
|
||||
else
|
||||
echo "❌ Trade execution failed!"
|
||||
ERROR=$(echo "$RESPONSE" | jq -r '.error // .message')
|
||||
echo " Error: $ERROR"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📊 Check container logs for details:"
|
||||
echo " docker logs trading-bot-v4 --tail 100"
|
||||
19
scripts/testing/trade.sh
Executable file
19
scripts/testing/trade.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Send manual trade command
|
||||
# Usage: ./trade.sh buy sol
|
||||
# ./trade.sh sell btc
|
||||
|
||||
COMMAND="$1 $2"
|
||||
|
||||
if [ -z "$COMMAND" ]; then
|
||||
echo "Usage: $0 <buy|sell> <sol|btc|eth>"
|
||||
echo "Example: $0 buy sol"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -X POST http://10.0.0.48:8098/webhook/3371ad7c-0866-4161-90a4-f251de4aceb8 \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": \"$COMMAND\"}"
|
||||
|
||||
echo ""
|
||||
echo "✅ Trade command sent: $COMMAND"
|
||||
Reference in New Issue
Block a user