feat: Helius primary + Alchemy fallback for trade execution

- Helius HTTPS: Primary RPC for Drift SDK initialization and subscriptions
- Alchemy HTTPS (10K CU/s): Fallback RPC for transaction confirmations
- Added getFallbackConnection() method to DriftService
- openPosition() and closePosition() now use Alchemy for tx confirmations
- accountSubscribe errors are non-fatal warnings (SDK falls back gracefully)
- System fully operational: Drift initialized, Position Manager ready
- Trade execution will use high-throughput Alchemy for confirmations
This commit is contained in:
mindesbunister
2025-11-14 16:51:14 +01:00
parent 1cf5c9aba1
commit 6445a135a8
3 changed files with 35 additions and 23 deletions

26
.env
View File

@@ -31,26 +31,16 @@ API_SECRET_KEY=2a344f0149442c857fb56c038c0c7d1b113883b830bec792c76f1e0efa15d6bb
# Solana RPC URL (Required for blockchain access)
#
# CRITICAL: Primary RPC for normal trading operations
# Current: Alchemy (300M compute units/month free tier, excellent stability)
SOLANA_RPC_URL=https://solana-mainnet.g.alchemy.com/v2/5A0iA5UYpsmP9gkuezYeg
# PRIMARY: Helius WebSocket RPC (supports accountSubscribe for Drift SDK)
SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=5e236449-f936-4af7-ae38-f15e2f1a3757
# Fallback RPC URL (Optional but HIGHLY recommended)
#
# SMART STRATEGY (DISABLED - Helius API key issue):
# 1. Bot STARTS with fallback (Helius) - handles startup burst better (10 req/sec sustained)
# 2. After init, SWITCHES to primary (Alchemy) - more stable for trading operations
# 3. On 429 errors, falls back to Helius temporarily, then returns to Alchemy
#
# TEMPORARILY DISABLED: Set to empty until Helius API key fixed
# SOLANA_FALLBACK_RPC_URL=https://mainnet.helius-rpc.com/?api-key=dcca4bf0-0b91-4f6a-8d12-1c5a4c1c6e5b
SOLANA_FALLBACK_RPC_URL=
# Fallback RPC URL (used for trade execution - higher throughput)
# Helius: startup/subscriptions, Alchemy: trade execution
SOLANA_FALLBACK_RPC_URL=https://solana-mainnet.g.alchemy.com/v2/5A0iA5UYpsmP9gkuezYeg
# RPC Provider Comparison (as of Nov 2025):
# ✅ Alchemy: 300M CU/month, excellent for trading operations (PRIMARY)
# ✅ Helius: 10 req/sec sustained, perfect for startup bursts (STARTUP + FALLBACK)
# QuickNode: Paid plans, very reliable
# Ankr/Public: Unreliable, not recommended
# Alternative RPC providers:
# QuickNode: https://solana-mainnet.quiknode.pro/YOUR_ENDPOINT/
# Public (not recommended): https://api.mainnet-beta.solana.com
# ================================
# REQUIRED - PYTH NETWORK (Price Feeds)