feat: implement symbol-specific position sizing for multi-asset trading

- Extended MarketConfig with optional positionSize and leverage fields
- Configured ETH-PERP at  @ 1x leverage for minimal-risk data collection
- Created getPositionSizeForSymbol() helper function in config/trading.ts
- Integrated symbol-specific sizing into execute endpoint
- Added comprehensive guide in docs/guides/SYMBOL_SPECIFIC_SIZING.md

Purpose: Enable ETH trading for faster signal quality data collection
         while preserving SOL's profit-generation sizing (0 @ 10x)

Next: Create ETH alert in TradingView and restart bot
This commit is contained in:
mindesbunister
2025-10-31 16:16:03 +01:00
parent a2d7cbcc4c
commit 26f70c6426
3 changed files with 301 additions and 3 deletions

View File

@@ -166,6 +166,14 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
// Get trading configuration
const config = getMergedConfig()
// Get symbol-specific position sizing
const { getPositionSizeForSymbol } = await import('@/config/trading')
const { size: positionSize, leverage } = getPositionSizeForSymbol(driftSymbol, config)
console.log(`📐 Symbol-specific sizing for ${driftSymbol}:`)
console.log(` Position size: $${positionSize}`)
console.log(` Leverage: ${leverage}x`)
// Initialize Drift service if not already initialized
const driftService = await initializeDriftService()
@@ -217,12 +225,12 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
}
// Calculate position size with leverage
const positionSizeUSD = config.positionSize * config.leverage
const positionSizeUSD = positionSize * leverage
console.log(`💰 Opening ${body.direction} position:`)
console.log(` Symbol: ${driftSymbol}`)
console.log(` Base size: $${config.positionSize}`)
console.log(` Leverage: ${config.leverage}x`)
console.log(` Base size: $${positionSize}`)
console.log(` Leverage: ${leverage}x`)
console.log(` Total position: $${positionSizeUSD}`)
// Open position