BeginnerUtilities & ToolsPython
Core Utilities¶
This folder contains core mathematical and date/time utilities that form the foundation for quantitative finance calculations.
Available Utilities¶
Date/Time (datetime_utils.py)¶
- Timestamp generation and parsing
- Trading day calculations
- Market hours checking
- Duration formatting
Mathematical (math_utils.py)¶
- Percentage calculations
- Compound interest and CAGR
- Data normalization
- Moving averages
- Linear regression
Usage¶
# Date/time operations
from datetime_utils import get_trading_days, is_market_open, format_duration
from math_utils import calculate_cagr, moving_average, linear_regression
# Trading operations
trading_days = get_trading_days(start_date, end_date)
if is_market_open():
print("Market is open!")
# Mathematical calculations
cagr = calculate_cagr(1000, 1500, 3)
ma = moving_average(prices, 20)
slope, intercept = linear_regression(x_data, y_data)
Installation¶
No additional dependencies required. Uses only Python standard library.
Testing¶
Run each utility directly to see demonstrations:
Common Use Cases¶
- Time Analysis: Calculate trading days and market hours
- Financial Calculations: Perform core mathematical operations
- Data Analysis: Normalize and analyze time series data
- Trend Analysis: Calculate moving averages and regressions
- Investment Planning: Calculate compound growth and returns
Continue in Utilities & Tools¶
-
This utility does NOT use any external APIs. All exchange rates are entered manually for learning and experimentation.
-
This folder contains utilities for data processing, validation, and manipulation in financial applications.
-
This utility does NOT use any external APIs. All data is managed locally for learning and experimentation.
-
A Node.js script that fetches historical bars (OHLCV data) for stocks or crypto from the Alpaca Market Data API. It prompts interactively for the symbol type, symbol, timeframe, and date range, then prints the results as JSON.
-
A pair of minimal, dependency-light logging utilities implemented in both Python and JavaScript. Each supports adding, reading, editing, and deleting log entries through an interactive command-line menu. All entries are persisted to a plain-text
log.txtfile in the working directory. -
This folder contains utilities for processing, analyzing, and fetching market data for financial applications.