Skip to main content

TimeStrader Preprocessing Package with TimesNet refactoring and VRAM optimization

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.12.tar.gz (12.1 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.12-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for timestrader_preprocessing-1.0.12.tar.gz
Algorithm Hash digest
SHA256 34dd8f86bf71b31171ddb1993d9822151c1b22adb57ff7a454c92ba6d9a73ba5
MD5 06336729d6e8e6b59f2e613b36e73f8c
BLAKE2b-256 5df20bb981dee46146b5878db10cfe9ef75e96f1eea0df5a5ac15b9167e1d57b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for timestrader_preprocessing-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 69111205c09628d3b51828f16ba78cf1cf0807951f9e6c2241a19fc88f10f00a
MD5 7b739496f390c11807b5e9c2c1341656
BLAKE2b-256 a1f4f51198f95d8ac2bcd964595a68aac4569c44cbb97bcea53b46a99cc4c72a

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