messy work. backtests / mock-data
This commit is contained in:
parent
4e4a048988
commit
fa70ada2bb
51 changed files with 2576 additions and 887 deletions
|
|
@ -1,16 +1,21 @@
|
|||
import * as path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { ConfigManager, createAppConfig } from '@stock-bot/config';
|
||||
import { getLogger } from '@stock-bot/logger';
|
||||
import { stockAppSchema, type StockAppConfig } from './schemas';
|
||||
|
||||
let configInstance: ConfigManager<StockAppConfig> | null = null;
|
||||
|
||||
// ESM-compatible __dirname
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
/**
|
||||
* Initialize the stock application configuration
|
||||
* @param serviceName - Optional service name to override port configuration
|
||||
*/
|
||||
export function initializeStockConfig(
|
||||
serviceName?: 'dataIngestion' | 'dataPipeline' | 'webApi'
|
||||
serviceName?: 'dataIngestion' | 'dataPipeline' | 'webApi' | 'orchestrator'
|
||||
): StockAppConfig {
|
||||
try {
|
||||
if (!configInstance) {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,27 @@ export const stockAppSchema = baseAppSchema.extend({
|
|||
.optional(),
|
||||
})
|
||||
.optional(),
|
||||
orchestrator: z
|
||||
.object({
|
||||
port: z.number().default(3002),
|
||||
defaultMode: z.enum(['backtest', 'paper', 'live']).default('paper'),
|
||||
paperTradingCapital: z.number().default(100000),
|
||||
enableWebSocket: z.boolean().default(true),
|
||||
backtesting: z
|
||||
.object({
|
||||
maxConcurrent: z.number().default(5),
|
||||
defaultSpeed: z.string().default('max'),
|
||||
dataResolutions: z.array(z.string()).default(['1m', '5m', '15m', '1h', '1d']),
|
||||
})
|
||||
.optional(),
|
||||
strategies: z
|
||||
.object({
|
||||
maxActive: z.number().default(10),
|
||||
defaultTimeout: z.number().default(30000),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue