Metadata-Version: 2.4
Name: quant-tiny
Version: 0.2.0
Summary: A tiny & lightweight quantitative trading framework for learning
Project-URL: Homepage, https://github.com/yushengyangchem/quant-tiny
Project-URL: Issues, https://github.com/yushengyangchem/quant-tiny/issues
Project-URL: Documentation, https://github.com/yushengyangchem/quant-tiny#readme
Author-email: yushengyangchem <yushengyangchem@gmail.com>
Maintainer-email: yushengyangchem <yushengyangchem@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: algorithmic-trading,backtesting,finance,learning,quant,trading
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# quant-tiny

A tiny & lightweight quantitative trading framework for learning.

## Installation

```bash
pip install quant-tiny
```

## Quick Start

```python
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.

```bash
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
