Skip to main content

A comprehensive Python quantitative finance library

Project description

DeltaFQ

A comprehensive Python quantitative finance library for strategy development, backtesting, and live trading.

Features

  • Data Management: Efficient data fetching, cleaning, and storage
  • Strategy Framework: Flexible strategy development framework
  • Backtesting: High-performance historical data backtesting
  • Paper Trading: Risk-free strategy testing with simulated trading
  • Live Trading: Real-time trading with broker integration
  • Technical Indicators: Rich library of technical analysis indicators
  • Risk Management: Built-in risk control modules

Installation

pip install deltafq

Quick Start

import deltafq as dfq

# Fetch market data
fetcher = dfq.data.DataFetcher()
fetcher.initialize()
data = fetcher.fetch_stock_data('AAPL', '2023-01-01', '2023-12-31')

# Clean and validate data
cleaner = dfq.data.DataCleaner()
cleaner.initialize()
cleaned_data = cleaner.clean_price_data(data)

validator = dfq.data.DataValidator()
validator.initialize()
validator.validate_price_data(cleaned_data)

# Create and test a strategy
class SimpleMAStrategy(dfq.strategy.BaseStrategy):
    def __init__(self, fast_period=10, slow_period=20):
        super().__init__()
        self.fast_period = fast_period
        self.slow_period = slow_period
    
    def generate_signals(self, data):
        fast_ma = data['close'].rolling(window=self.fast_period).mean()
        slow_ma = data['close'].rolling(window=self.slow_period).mean()
        import numpy as np
        signals = np.where(fast_ma > slow_ma, 1, np.where(fast_ma < slow_ma, -1, 0))
        return pd.Series(signals, index=data.index)

strategy = SimpleMAStrategy()
strategy.initialize()
results = strategy.run(cleaned_data)

# Run backtest
engine = dfq.backtest.BacktestEngine(initial_capital=100000)
engine.initialize()
backtest_results = engine.run_backtest(strategy, cleaned_data)

# Run paper trading
simulator = dfq.trading.PaperTradingSimulator(initial_capital=100000)
simulator.initialize()
portfolio_summary = simulator.run_strategy(strategy, cleaned_data)

Documentation

Contributing

Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

deltafq-0.2.0.tar.gz (43.0 kB view details)

Uploaded Source

Built Distribution

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

deltafq-0.2.0-py3-none-any.whl (54.6 kB view details)

Uploaded Python 3

File details

Details for the file deltafq-0.2.0.tar.gz.

File metadata

  • Download URL: deltafq-0.2.0.tar.gz
  • Upload date:
  • Size: 43.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for deltafq-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4f7d50f9c83ea471cb2993f6ad7eed1572a86e5b4baefd178f72146afc5499de
MD5 08680644fee7a58e9dd4e169681c309e
BLAKE2b-256 932064fd12234f7d2a858fec0edf34be852bbbc7982345ba5dd58b0c155e735f

See more details on using hashes here.

File details

Details for the file deltafq-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: deltafq-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 54.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for deltafq-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8f76e1f7c7524502a74a57f0aeedaf47f47806da81af21a7c9f6f50edee61b6
MD5 66ed71939e066d39c37c0af15f1e7e1e
BLAKE2b-256 1c2adeebacf5f41221a41fdba2d95a117fd998834da7d89afa84e68437d1975f

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