| 123456789101112131415161718192021 |
- import { marketDataFetcher } from './market/marketDataFetcher'
- import { positionStrategy } from './strategy/positionStrategy'
- import { hedgingExecutor } from './hedging/hedgingExecutor'
- import { riskAssessor } from '../risk/riskAssessor'
- import { logger } from '../utils/logger'
- export async function startApp() {
- await marketDataFetcher.init()
- const symbols = ['BTCUSDT', 'ETHUSDT']
- marketDataFetcher.subscribe(symbols, ['1m'])
- setInterval(async () => {
- const signals = positionStrategy.generateSignals(symbols)
- for (const s of signals) {
- if (s.action === 'hedge' && s.quantity > 0) {
- const tx = await hedgingExecutor.hedgeSpot(s.symbol, s.quantity)
- logger.info(`Hedge executed: ${tx}`)
- }
- }
- }, 5000)
- }
|