workspace/projects/trading-platform/packages/config/index.ts
rckrdmrd 49155822ae fix: Resolve TypeScript compilation errors across all projects
Platform Marketing Content:
- Add PaginationParams, PaginationMeta, PaginatedResponse interfaces
- Fix JwtAuthGuard import paths (common/guards instead of modules/auth)
- Add missing fields to CRM interfaces (address, keywords, features, benefits)
- Install @nestjs/throttler dependency

ERP Suite - Construccion:
- Create tsconfig.node.json for web frontend
- Add vite-env.d.ts for Vite types
- Fix implicit return errors in Express controllers
- Prefix unused parameters with underscore

ERP Suite - ERP Core:
- Export PoolClient type from database config
- Fix invoice type comparison (customer/supplier vs out_invoice)
- Refactor base.service.ts query handling for proper type inference
- Rename Role type to RoleType to avoid conflict with entity
- Fix ProtectedRoute to use role?.name instead of roles array

ERP Suite - POS Micro:
- Add vite-env.d.ts for Vite types
- Fix Sale property names (discountAmount, changeAmount)
- Export TodaySummary interface from sales service

All projects now pass npm install and npm run build successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-08 22:35:55 -06:00

202 lines
5.8 KiB
TypeScript

/**
* Configuración centralizada para OrbiQuant Trading Platform
*
* Este archivo define todas las URLs, puertos y configuraciones
* que deben ser compartidas entre servicios.
*/
// ============================================================================
// Service URLs
// ============================================================================
export const SERVICES = {
BACKEND: {
name: 'backend',
port: 3000,
url: process.env.BACKEND_URL || 'http://localhost:3000',
healthPath: '/health',
},
ML_ENGINE: {
name: 'ml-engine',
port: 8001,
url: process.env.ML_ENGINE_URL || 'http://localhost:8001',
healthPath: '/health',
},
DATA_SERVICE: {
name: 'data-service',
port: 8002,
url: process.env.DATA_SERVICE_URL || 'http://localhost:8002',
healthPath: '/health',
},
LLM_AGENT: {
name: 'llm-agent',
port: 8003,
url: process.env.LLM_AGENT_URL || 'http://localhost:8003',
healthPath: '/health',
},
TRADING_AGENTS: {
name: 'trading-agents',
port: 8004,
url: process.env.TRADING_AGENTS_URL || 'http://localhost:8004',
healthPath: '/health',
},
FRONTEND: {
name: 'frontend',
port: 5173,
url: process.env.FRONTEND_URL || 'http://localhost:5173',
},
} as const;
// ============================================================================
// Database
// ============================================================================
export const DATABASE = {
host: process.env.DB_HOST || 'localhost',
port: parseInt(process.env.DB_PORT || '5432'),
name: process.env.DB_NAME || 'orbiquant',
user: process.env.DB_USER || 'orbiquant',
password: process.env.DB_PASSWORD || '',
ssl: process.env.DB_SSL === 'true',
} as const;
// ============================================================================
// Redis
// ============================================================================
export const REDIS = {
host: process.env.REDIS_HOST || 'localhost',
port: parseInt(process.env.REDIS_PORT || '6379'),
password: process.env.REDIS_PASSWORD || '',
db: parseInt(process.env.REDIS_DB || '0'),
} as const;
// ============================================================================
// External APIs
// ============================================================================
export const EXTERNAL_APIS = {
BINANCE: {
apiUrl: process.env.BINANCE_API_URL || 'https://api.binance.com',
wsUrl: process.env.BINANCE_WS_URL || 'wss://stream.binance.com:9443',
testnetApiUrl: 'https://testnet.binance.vision',
testnetWsUrl: 'wss://testnet.binance.vision',
},
STRIPE: {
apiUrl: 'https://api.stripe.com',
webhookPath: '/webhooks/stripe',
},
OLLAMA: {
url: process.env.OLLAMA_URL || 'http://localhost:11434',
model: process.env.OLLAMA_MODEL || 'llama3',
},
} as const;
// ============================================================================
// API Versioning
// ============================================================================
export const API = {
version: 'v1',
basePath: '/api/v1',
} as const;
// ============================================================================
// Timeouts & Retries
// ============================================================================
export const TIMEOUTS = {
default: 30000,
ml: 60000,
llm: 120000,
trading: 10000,
} as const;
export const RETRIES = {
attempts: 3,
delay: 1000,
backoffMultiplier: 2,
} as const;
// ============================================================================
// WebSocket Channels
// ============================================================================
export const WS_CHANNELS = {
TICKER: 'ticker',
ORDERBOOK: 'orderbook',
TRADES: 'trades',
CANDLES: 'candles',
SIGNALS: 'signals',
ORDERS: 'orders',
POSITIONS: 'positions',
NOTIFICATIONS: 'notifications',
} as const;
// ============================================================================
// Trading Constants
// ============================================================================
export const TRADING = {
defaultLeverage: 1,
maxLeverage: 100,
minOrderSize: 0.001,
maxOrderSize: 1000000,
supportedTimeframes: ['1m', '5m', '15m', '1h', '4h', '1d', '1w'] as const,
supportedOrderTypes: ['market', 'limit', 'stop_loss', 'take_profit'] as const,
} as const;
// ============================================================================
// Agent Profiles
// ============================================================================
export const AGENT_PROFILES = {
ATLAS: {
name: 'Atlas',
profile: 'conservative',
maxDrawdown: 0.05,
targetMonthly: 0.03,
riskPerTrade: 0.01,
},
ORION: {
name: 'Orion',
profile: 'moderate',
maxDrawdown: 0.10,
targetMonthly: 0.07,
riskPerTrade: 0.02,
},
NOVA: {
name: 'Nova',
profile: 'aggressive',
maxDrawdown: 0.20,
targetMonthly: 0.15,
riskPerTrade: 0.03,
},
} as const;
// ============================================================================
// Helper Functions
// ============================================================================
export function getServiceUrl(serviceName: keyof typeof SERVICES): string {
return SERVICES[serviceName].url;
}
export function buildApiUrl(serviceName: keyof typeof SERVICES, path: string): string {
const baseUrl = getServiceUrl(serviceName);
const cleanPath = path.startsWith('/') ? path : `/${path}`;
return `${baseUrl}${API.basePath}${cleanPath}`;
}
export function getDatabaseUrl(): string {
const { user, password, host, port, name, ssl } = DATABASE;
const sslParam = ssl ? '?sslmode=require' : '';
return `postgresql://${user}:${password}@${host}:${port}/${name}${sslParam}`;
}
export function getRedisUrl(): string {
const { host, port, password, db } = REDIS;
const auth = password ? `:${password}@` : '';
return `redis://${auth}${host}:${port}/${db}`;
}