Skip to main content

A comprehensive library for creating and backtesting trading strategies.

Project description

Quantaforge

Quantaforge is a comprehensive library for creating and backtesting trading strategies.

Features

  • Define custom trading strategies using various indicators, signals, and risk management techniques.
  • Backtest strategies with historical data.
  • Optimize strategy parameters.
  • Generate detailed performance reports.

Installation

pip install quantaforge

Usage

import quantaforge as qf

# Create a new strategy
strategy = qf.Strategy()

# Add a new indicator
strategy.add_indicator(qf.Indicator('SMA', 5))

# Add a new signal
strategy.add_signal(qf.Signal('CrossOver', 'SMA', 5))

# Add a new position
strategy.add_position(qf.Position('Long', 1))

# Add a new risk management
strategy.add_risk_management(qf.RiskManagement('StopLoss', 0.02))

# Add a new portfolio
portfolio = qf.Portfolio('SimplePortfolio', 100000)
strategy.add_portfolio(portfolio)

# Add a new backtest
backtest = qf.Backtest(name='SimpleBacktest', strategy=strategy, portfolio=portfolio)

# Mock data to emulate a 5 day SMA crossover strategy

data = {
    'symbol': ['AAPL'] * 20,
    'close': [150, 152, 148, 151, 155, 160, 158, 162, 165, 170, 175, 180, 190, 210, 200, 190, 180, 170, 160, 150]
}

# Set the data for the backtest
backtest.set_data(data)
strategy.add_backtest(backtest)

# Add a new report
report = qf.Report(portfolio=portfolio)
strategy.add_report(report)

# Run the strategy
strategy.run()
strategy.report.generate()

License

MIT

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

quantaforge-0.1.3.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

quantaforge-0.1.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file quantaforge-0.1.3.tar.gz.

File metadata

  • Download URL: quantaforge-0.1.3.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.10

File hashes

Hashes for quantaforge-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9b93bbf0499ac028537b9655ee40c775a96b0d848ebc4d50763600e00caf8132
MD5 dbe3744f74c03cad5781af7f4f1a5687
BLAKE2b-256 3b1586c79d6b636a6fcf149cd6cebc875dcb1745710d5fd0c0ece8429b47d2e3

See more details on using hashes here.

File details

Details for the file quantaforge-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: quantaforge-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.10

File hashes

Hashes for quantaforge-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f6063f9f534305af6527b4ee85bb68a8a58c710ca516d7fbbb40598bd61d8038
MD5 75b8d3eb86903fc0ff92a1943832ca35
BLAKE2b-256 8fe059803741d3098363ffb96e60f46b007fb359295302ca4e09fbf791ddb987

See more details on using hashes here.

Supported by

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