https://github.com/tfukaza/harvest
Simple and intuitive Python framework for algorithmic trading. Easily create bots to live and paper trade stocks, crypto, and options!
https://github.com/tfukaza/harvest
algorithmic-trading backtesting cryptocurrency options paper-trading python stock trading trading-bot
Last synced: 3 months ago
JSON representation
Simple and intuitive Python framework for algorithmic trading. Easily create bots to live and paper trade stocks, crypto, and options!
- Host: GitHub
- URL: https://github.com/tfukaza/harvest
- Owner: tfukaza
- License: mit
- Created: 2021-06-25T21:29:38.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2026-03-11T05:10:37.000Z (3 months ago)
- Last Synced: 2026-03-11T10:49:28.383Z (3 months ago)
- Topics: algorithmic-trading, backtesting, cryptocurrency, options, paper-trading, python, stock, trading, trading-bot
- Language: Python
- Homepage: https://tfukaza.github.io/harvest-website
- Size: 3.49 MB
- Stars: 146
- Watchers: 12
- Forks: 28
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README

Harvest is a simple yet flexible Python framework for algorithmic trading. Paper trade and live trade stocks, cryptos, and options![^1][^2] Visit [**here**](https://tfukaza.github.io/harvest-website) for tutorials and documentation.
[](https://codecov.io/gh/tfukaza/harvest)

[](https://github.com/psf/black)
---
**⚠️WARNING⚠️**
Harvest is currently at **v0.3**. The program is unstable and contains many bugs. Use with caution, and contributions are greatly appreciated.
- 🪲 [File a bug report](https://github.com/tfukaza/harvest/issues/new?assignees=&labels=bug&template=bug_report.md&title=%5B%F0%9F%AA%B0BUG%5D)
- 💡 [Submit a feature suggestion](https://github.com/tfukaza/harvest/issues/new?assignees=&labels=enhancement%2C+question&template=feature-request.md&title=%5B%F0%9F%92%A1Feature+Request%5D)
- 📝 [Request documentation](https://github.com/tfukaza/harvest/issues/new?assignees=&labels=documentation&template=documentation.md&title=%5B%F0%9F%93%9DDocumentation%5D)
# See for yourself!
The example below is an algorithm to trade Twitter stocks using the moving average crossover strategy.
```python
from harvest.algo import *
from harvest.trader import *
class Watch(BaseAlgo):
def config(self):
self.watchlist = ["TWTR"]
self.interval = "5MIN"
def main(self):
sma_long = self.sma(period=50)
sma_short = self.sma(period=20)
if self.crossover(sma_long, sma_short):
self.buy()
elif self.crossover(sma_short, sma_long):
self.sell()
```
To paper trade using this algorithm, run the following command:
```bash
harvest start -s yahoo -b paper
```
To live trade using Robinhood, run:
```bash
harvest start -s robinhood -b robinhood
```
With Harvest, the process of testing and deploying your strategies is a piece of cake 🍰
# Installation
The only requirement is to have **Python 3.12 or newer**.
Once you're ready, install [uv](https://docs.astral.sh/uv/). If you want the Harvest CLI available on your machine, install it with:
```bash
uv tool install harvest-python
```
If you are adding Harvest to another Python project, use:
```bash
uv add harvest-python
```
Next, install the dependencies necessary for the brokerage of your choice:
```bash
uv add 'harvest-python[BROKER]'
```
Replace `BROKER` with a brokerage/data source of your choice in lowercase:
- Robinhood
- Alpaca
- Webull
- Kraken
- Polygon
If you installed Harvest as a tool, you can run commands directly:
```bash
harvest start -s yahoo -b paper
```
If you added Harvest to a project, run commands with `uv run`, for example:
```bash
uv run harvest start -s yahoo -b paper
```
Now you're all set.
# Contributing
Contributions are greatly appreciated. Check out the [CONTRIBUTING](CONTRIBUTING.md) document for details, and [ABOUT](ABOUT.md) for the long-term goals of this project.
# Disclaimer
- Harvest is not officially associated with Robinhood, Alpaca, Webull, Kraken, Polygon, or Yahoo.
- Many of the brokers were also not designed to be used for algo-trading. Excessive access to their API can result in your account getting locked.
- Tutorials and documentation solely exist to provide technical references of the code. They are not recommendations of any specific securities or strategies.
- Use Harvest at your own responsibility. Developers of Harvest take no responsibility for any financial losses you incur by using Harvest. By using Harvest, you certify you understand that Harvest is a software in early development and may contain bugs and unexpected behaviors.
# Linter
- Trunk is a wrapper around linters. see `trunk.yaml` for details on which linters are enabled
- Currently we run `ruff` which supports isort, pylint, black
- For the best experience, please install the proper extensions under vscode "recommended extensions"
- To run lint checks manually, use `trunk check`, to run formatters, use `trunk fmt`
- To run lint & format checks automatically, install the extensions recommended and save
[^1]: What assets you can trade depends on the broker you are using.
[^2]: Backtesting is also available, but it is not supported for options.