fixed all libs to be buildiable and dependency hell from removing some
This commit is contained in:
parent
5c64b1ccf8
commit
a282dac6cd
40 changed files with 4050 additions and 8219 deletions
|
|
@ -23,29 +23,12 @@ const nextTradingDay = dateUtils.getNextTradingDay(new Date());
|
|||
Mathematical functions for financial calculations:
|
||||
|
||||
```typescript
|
||||
import { financialUtils } from '@stock-bot/utils';
|
||||
import { calculateCAGR, calculateSharpeRatio } from '@stock-bot/utils';
|
||||
|
||||
// Calculate compound annual growth rate
|
||||
const returns = [0.05, 0.03, -0.01, 0.04, 0.02];
|
||||
const cagr = calculateCAGR(startValue, endValue, years);
|
||||
|
||||
// Calculate Sharpe ratio
|
||||
const returns = [0.05, 0.03, -0.01, 0.04, 0.02];
|
||||
const sharpeRatio = financialUtils.calculateSharpeRatio(returns, 0.02);
|
||||
|
||||
// Calculate maximum drawdown
|
||||
const equityCurve = [10000, 10500, 10200, 10800, 10300];
|
||||
const maxDrawdown = financialUtils.calculateMaxDrawdown(equityCurve);
|
||||
```
|
||||
|
||||
### Logger
|
||||
|
||||
Standardized logging service:
|
||||
|
||||
```typescript
|
||||
import { createLogger, LogLevel } from '@stock-bot/utils';
|
||||
|
||||
// Create a logger for your service
|
||||
const logger = createLogger('strategy-orchestrator', LogLevel.INFO);
|
||||
|
||||
// Log at different levels
|
||||
logger.info('Strategy initialized');
|
||||
logger.warn('Position size exceeds recommended limit');
|
||||
logger.error('Failed to execute order', { orderId: '123', reason: 'Insufficient funds' });
|
||||
const sharpeRatio = calculateSharpeRatio(returns, 0.02);
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue