| .. | ||
| src | ||
| test | ||
| package.json | ||
| POSITION_SIZING_FIXES.md | ||
| README.md | ||
| tsconfig.json | ||
| turbo.json | ||
Utils Library
Common utility functions shared across services in the stock-bot project.
Included Utilities
Date Utilities
Helper functions for working with market dates:
import { dateUtils } from '@stock-bot/utils';
// Check if a date is a trading day
const isTradingDay = dateUtils.isTradingDay(new Date());
// Get the next trading day
const nextTradingDay = dateUtils.getNextTradingDay(new Date());
Financial Utilities
Mathematical functions for financial calculations:
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 sharpeRatio = calculateSharpeRatio(returns, 0.02);