77 lines
2.2 KiB
Python
77 lines
2.2 KiB
Python
"""
|
|
Converted MATLAB Trading Algorithms to Python
|
|
|
|
This package contains Python implementations of various algorithmic trading strategies
|
|
and utility functions originally written in MATLAB. It now includes data loading
|
|
capabilities for converted .mat files.
|
|
|
|
Utility Functions:
|
|
- backshift: Shift data backward in time
|
|
- fwdshift: Shift data forward in time
|
|
- movingAvg: Calculate moving averages
|
|
- movingStd: Calculate moving standard deviations
|
|
- smartmean: Mean calculation ignoring NaN/Inf
|
|
- smartstd: Standard deviation ignoring NaN/Inf
|
|
- smartsum: Sum calculation ignoring NaN/Inf
|
|
- smartMovingStd: Moving standard deviation ignoring NaN/Inf
|
|
- calculateReturns: Calculate returns from price series
|
|
- calculateMaxDD: Calculate maximum drawdown
|
|
|
|
Data Loading:
|
|
- data_loader: Load converted CSV/JSON data files
|
|
- DataLoader: Class for managing data loading operations
|
|
|
|
Trading Strategies:
|
|
- TU_mom: Treasury futures momentum strategy
|
|
- TU_mom_hypothesisTest: Hypothesis testing for TU momentum
|
|
- kentdaniel: Long-short equity momentum strategy
|
|
- gapFutures_FSTX: Gap trading strategy for futures
|
|
- pead: Post-earnings announcement drift strategy
|
|
|
|
The strategies now attempt to load real market data from converted files,
|
|
falling back to synthetic data for demonstration if real data is unavailable.
|
|
"""
|
|
|
|
__version__ = "1.0.0"
|
|
__author__ = "Converted from MATLAB"
|
|
|
|
# Import main utility functions
|
|
from .backshift import backshift
|
|
from .fwdshift import fwdshift
|
|
from .movingAvg import movingAvg
|
|
from .movingStd import movingStd
|
|
from .smartmean import smartmean
|
|
from .smartstd import smartstd
|
|
from .smartsum import smartsum
|
|
from .smartMovingStd import smartMovingStd
|
|
from .calculateReturns import calculateReturns
|
|
from .calculateMaxDD import calculateMaxDD
|
|
|
|
# Import data loading functions
|
|
from .data_loader import (
|
|
DataLoader,
|
|
load_earnings_data,
|
|
load_futures_data,
|
|
load_etf_data,
|
|
load_stock_data,
|
|
load_interest_rates
|
|
)
|
|
|
|
__all__ = [
|
|
'backshift',
|
|
'fwdshift',
|
|
'movingAvg',
|
|
'movingStd',
|
|
'smartmean',
|
|
'smartstd',
|
|
'smartsum',
|
|
'smartMovingStd',
|
|
'calculateReturns',
|
|
'calculateMaxDD',
|
|
'DataLoader',
|
|
'load_earnings_data',
|
|
'load_futures_data',
|
|
'load_etf_data',
|
|
'load_stock_data',
|
|
'load_interest_rates'
|
|
] |