TimeStrader Preprocessing Package with MNQ-optimized TimesNet (6h history, 15min prediction)
Project description
TimeStrader Preprocessing Package
A comprehensive data preprocessing package optimized for TimesNet and PPO model training in financial trading systems. This package provides historical data processing, normalization, and technical indicator calculation for financial time series data.
Features
- Historical Data Processing: Efficient processing of financial time series data
- Advanced Normalization: Multiple normalization methods including z-score with customizable scalers
- Technical Indicators: Built-in technical analysis indicators
- Data Leakage Prevention: Proper train/validation/test splitting with scaler management
- Performance Optimized: Designed for high-frequency trading applications
Installation
pip install timestrader-preprocessing
Quick Start
import pandas as pd
from timestrader_preprocessing import HistoricalProcessor
# Initialize processor
processor = HistoricalProcessor()
# Process your financial data
data = pd.DataFrame({
'open': [100, 101, 102, 103, 104],
'high': [101, 102, 103, 104, 105],
'low': [99, 100, 101, 102, 103],
'close': [100.5, 101.5, 102.5, 103.5, 104.5],
'volume': [1000, 1100, 1200, 1300, 1400]
})
# Normalize data with proper train/validation/test splitting
train_data, scaler = processor.normalize_data(train_data, return_scaler=True)
val_data = processor.normalize_data(val_data, scaler=scaler)
test_data = processor.normalize_data(test_data, scaler=scaler)
Advanced Usage
Data Leakage Prevention
The package provides robust data leakage prevention for machine learning pipelines:
from sklearn.preprocessing import StandardScaler
from timestrader_preprocessing import HistoricalProcessor
processor = HistoricalProcessor()
# Training phase - fit scaler on training data only
train_normalized, scaler = processor.normalize_data(
training_data,
return_scaler=True,
method='zscore'
)
# Validation phase - use existing scaler
val_normalized = processor.normalize_data(
validation_data,
scaler=scaler
)
# Test phase - use existing scaler
test_normalized = processor.normalize_data(
test_data,
scaler=scaler
)
Technical Indicators
# Calculate technical indicators
processed_data = processor.calculate_technical_indicators(data)
# Available indicators include:
# - Moving Averages (SMA, EMA)
# - RSI (Relative Strength Index)
# - MACD (Moving Average Convergence Divergence)
# - Bollinger Bands
# - And many more...
Requirements
- Python 3.9+
- pandas>=2.0.0
- numpy>=1.26.0
- scikit-learn>=1.3.0
- pydantic>=1.10.0
Integration with TimeStrader
This package is designed to work seamlessly with the TimeStrader trading system:
- TimesNet Training: Provides properly normalized historical data for time series forecasting
- PPO Training: Supplies normalized features with proper train/validation/test splits
- Production Inference: Efficient real-time data processing for trading decisions
Version History
Version 1.0.9
- Fixed data leakage prevention in normalize_data method
- Added scaler parameter support for consistent normalization
- Improved train/validation/test data splitting
- Enhanced performance for high-frequency trading applications
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For technical support and questions, please visit our GitHub repository.
Contributing
We welcome contributions! Please see our contributing guidelines for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timestrader_preprocessing-1.0.13.tar.gz.
File metadata
- Download URL: timestrader_preprocessing-1.0.13.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99acdffc38b21ebf58f8322d496a6f18108652f1c7d2b22163de3033bd478cf8
|
|
| MD5 |
49e093449d09d9d16b40c044eb440fc1
|
|
| BLAKE2b-256 |
6616d995e7cbc9da4744ed0e9921f891d9acf80b016f021d94509f049cb07f2c
|
File details
Details for the file timestrader_preprocessing-1.0.13-py3-none-any.whl.
File metadata
- Download URL: timestrader_preprocessing-1.0.13-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bccfe9a77d599eae85e706eea28b17e04405013888685247944d7f5a7b61a4d9
|
|
| MD5 |
d9208520639ee9784f5899b44a052254
|
|
| BLAKE2b-256 |
5d00eff876624cb76212a9030791fbb712871bbe632ba3614b6427a203c58277
|