Skip to main content

TimeStrader Preprocessing Package with MNQ-optimized TimesNet (6h history, 15min prediction)

Project description

TimeStrader Preprocessing Package

PyPI version Python

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:

  1. TimesNet Training: Provides properly normalized historical data for time series forecasting
  2. PPO Training: Supplies normalized features with proper train/validation/test splits
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timestrader_preprocessing-1.0.13.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timestrader_preprocessing-1.0.13-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file timestrader_preprocessing-1.0.13.tar.gz.

File metadata

File hashes

Hashes for timestrader_preprocessing-1.0.13.tar.gz
Algorithm Hash digest
SHA256 99acdffc38b21ebf58f8322d496a6f18108652f1c7d2b22163de3033bd478cf8
MD5 49e093449d09d9d16b40c044eb440fc1
BLAKE2b-256 6616d995e7cbc9da4744ed0e9921f891d9acf80b016f021d94509f049cb07f2c

See more details on using hashes here.

File details

Details for the file timestrader_preprocessing-1.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for timestrader_preprocessing-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 bccfe9a77d599eae85e706eea28b17e04405013888685247944d7f5a7b61a4d9
MD5 d9208520639ee9784f5899b44a052254
BLAKE2b-256 5d00eff876624cb76212a9030791fbb712871bbe632ba3614b6427a203c58277

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page