stock-bot/libs/utils
2025-06-09 20:00:08 -04:00
..
src fixed libs 2025-06-04 22:56:03 -04:00
test added more functions 2025-06-04 19:27:11 -04:00
package.json fixed up lib packages to remove bun dev since they will be imported into apps 2025-06-08 14:15:04 -04:00
POSITION_SIZING_FIXES.md work on calculations 2025-06-04 18:16:16 -04:00
README.md fixed all libs to be buildiable and dependency hell from removing some 2025-06-04 16:07:08 -04:00
tsconfig.json trying to fix build 2025-06-09 20:00:08 -04:00

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);