Skip to main content

Fast and intuitive backtesting for Python

Project description

Quantix

PyPI version Python License: MIT Code style: ruff

Fast and intuitive backtesting for Python

InstallationQuick StartDocumentationCommunity


🚀 What is Quantix?

Quantix is a Python backtesting library that combines the speed of VectorBT with the simplicity of modern Python frameworks. No more choosing between performance and usability!

import quantix as qx
from datetime import date

# This is all you need for a complete backtest
data = qx.load("AAPL", start=date(2020, 1, 1))

@qx.strategy
def my_strategy(bar):
    if bar.rsi < 30:
        return qx.buy()
    elif bar.rsi > 70:
        return qx.sell()
    return qx.hold()

result = qx.backtest(data, my_strategy, cash=10000)
result.plot()  # Beautiful interactive charts

📈 Features

  • Lightning Fast: Matches VectorBT's performance with 10x better API
  • Intuitive API: Write strategies in plain Python - no PhD required
  • Built-in Indicators: 50+ indicators included, easy to add custom ones
  • Beautiful Visualizations: Interactive plots that actually make sense
  • Risk Management: Built-in stop-loss, take-profit, and position sizing
  • Multiple Assets: Backtest portfolios with ease

📦 Installation

pip install quantix-trading

🎯 Quick Start

Simple Moving Average Strategy

import quantix as qx
from datetime import date

# Load data
data = qx.load("AAPL", start=date(2020, 1, 1), end=date(2023, 12, 31))

# Define strategy
@qx.strategy(stop_loss=0.02, take_profit=0.05)
def sma_strategy(bar):
    # Clean access to indicators
    if bar.close > bar.sma(50) and bar.close_prev <= bar.sma_prev(50):
        return qx.buy()
    elif bar.close < bar.sma(20) and bar.close_prev >= bar.sma_prev(20):
        return qx.sell()
    return qx.hold()

# Run backtest
result = qx.backtest(
    data=data,
    strategy=sma_strategy,
    cash=10000,
    commission=0.001
)

# Analyze results
print(f"Total Return: {result.total_return:.2%}")
print(f"Sharpe Ratio: {result.sharpe_ratio:.2f}")
print(f"Max Drawdown: {result.max_drawdown:.2%}")

# Visualize
result.plot()

🛠️ Status

⚠️ Early Development: We're building this in public! Star the repo to follow our progress.

Roadmap

  • Week 1: Project setup and basic structure
  • Week 2: Data management and caching
  • Week 3: Strategy engine and backtesting
  • Week 4: Technical indicators
  • Month 2: Visualization and optimization
  • Month 3: Community and advanced features

🤝 Contributing

We'd love your help! Check out our Contributing Guide to get started.

# Clone the repo
git clone https://github.com/quantix-io/quantix.git
cd quantix

# Install with poetry
poetry install

# Run tests
poetry run pytest

# Run linting
poetry run ruff check .
poetry run ruff format .

💬 Community

📄 License

MIT License - see LICENSE for details.


Built with ❤️ by traders, for traders

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

quantix_trading-0.2.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

quantix_trading-0.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quantix_trading-0.2.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.10 Darwin/24.5.0

File hashes

Hashes for quantix_trading-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1414cd0d8b5ad939cd58597d6b42260b5b3a3765665463f9cd5c31005a6b5882
MD5 9435d5bf9b181b2d992784085fa2e4ad
BLAKE2b-256 9edb993b618ac228307ad62bfb13e903a73bedb22d087517e82698f7b3cde269

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quantix_trading-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.10 Darwin/24.5.0

File hashes

Hashes for quantix_trading-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb1e697bcacf5c7a778a9d0d4693e0f5e921c04ca857134ba111617f77857e06
MD5 4eeff90a6d1e46d0ea1e8fd43dad490c
BLAKE2b-256 f49bff57a525d465ba1ff86e612b26aaad36e9f3432eaff93b4f80d732fc4fec

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