Skip to main content

quant-tiny

A tiny & lightweight quantitative trading framework for learning.

Installation

pip install quant-tiny

Quick Start

from quant_tiny import Backtest, Bar, Strategy


class MyStrategy(Strategy):
    def on_bar(self, bar: Bar, portfolio):
        if portfolio.position.is_flat and bar.close > 100:
            return [self.buy(bar.timestamp, 10, bar.close)]
        return []

data = [
    Bar("2024-01-01", 100, 105, 95, 102, 1000),
    Bar("2024-01-02", 102, 108, 100, 106, 1200),
]

backtest = Backtest(data, MyStrategy())
result = backtest.run()
print(f"Final value: ${result['final_value']:.2f}")
print(f"Total trades: {result['total_trades']}")

Run Tests

This project keeps example strategies in pytest tests instead of a separate examples/ directory.

pytest -q

You can find the demo strategy and regression tests in tests/test_core.py.

Features

  • Core Components: Strategy, Bar, Order, Portfolio, Position
  • Backtesting: Simple event-driven backtest engine
  • Indicators: sma(), ema(), rsi()

License

MIT

Metadata

Release files for quant-tiny 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quant-tiny 0.2.0
File Size Uploaded Provenance Actions
quant_tiny-0.2.0.tar.gz 7.4 kB Without provenance Details for quant_tiny-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quant-tiny 0.2.0
File Interpreter ABI Platform Actions
quant_tiny-0.2.0-py3-none-any.whl Python 3 none any Details for quant_tiny-0.2.0-py3-none-any.whl

Total release size: 12.4 kB

Release files / quant_tiny-0.2.0.tar.gz

Download URL quant_tiny-0.2.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f66e825c30dbf4b6f97f12be3124555f0a2abc324be4ab4ffa940b78ec076947
BLAKE2b-256 checksum
How to use checksums
815886a67f61646b8e45d08f5e8a9bfe6bc8932d3a683faa3bc5f09e7c22acd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / quant_tiny-0.2.0-py3-none-any.whl

Download URL quant_tiny-0.2.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4680d0ab00164cd55b8aebf753b01880a4f5c00bb5c6d75f754d7e31e990427c
BLAKE2b-256 checksum
How to use checksums
c7903e2c2910c8e44563092fd2a9f3aa41d0ac5ca92a4d1b40f29f87e448d575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for quant-tiny 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page