feat: Add persistent settings and multiple layouts support
- Add settings manager to persist symbol, timeframe, and layouts - Support multiple layouts for comprehensive chart analysis - Remove debug screenshots for cleaner logs - Update AI analysis with professional trading prompt - Add multi-screenshot analysis for better trading insights - Update analyze API to use saved settings and multiple layouts
This commit is contained in:
33
app/api/auto-trading/route.ts
Normal file
33
app/api/auto-trading/route.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { getAutoTradingService } from '../../../lib/auto-trading'
|
||||
|
||||
const autoTradingService = getAutoTradingService()
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const { action, config } = await req.json()
|
||||
if (action === 'start') {
|
||||
autoTradingService.start()
|
||||
return NextResponse.json({ status: 'started' })
|
||||
}
|
||||
if (action === 'stop') {
|
||||
autoTradingService.stop()
|
||||
return NextResponse.json({ status: 'stopped' })
|
||||
}
|
||||
if (action === 'config' && config) {
|
||||
autoTradingService.setConfig(config)
|
||||
return NextResponse.json({ status: 'config updated', config: autoTradingService })
|
||||
}
|
||||
return NextResponse.json({ error: 'Invalid action' }, { status: 400 })
|
||||
} catch (e: any) {
|
||||
return NextResponse.json({ error: e.message }, { status: 500 })
|
||||
}
|
||||
}
|
||||
|
||||
export async function GET() {
|
||||
// Return current config/status
|
||||
return NextResponse.json({
|
||||
config: autoTradingService,
|
||||
running: !!autoTradingService['intervalId']
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user