Files
trading_bot_v4/scripts/testing/test-exit-orders.sh
mindesbunister 14d5de2c64 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
2025-10-27 12:59:25 +01:00

74 lines
1.9 KiB
Bash
Executable File

#!/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"