Skip to main content

Header
Harvest is a simple yet flexible Python framework for algorithmic trading. Paper trade and live trade stocks, cryptos, and options!12 Visit here for tutorials and documentation.


codecov run tests Code style: Black

⚠️WARNING⚠️ Harvest is currently at v0.3. The program is unstable and contains many bugs. Use with caution, and contributions are greatly appreciated.

See for yourself!

The example below is an algorithm to trade Twitter stocks using the moving average crossover strategy.

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:

harvest start -s yahoo -b paper 

To live trade using Robinhood, run:

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.9 or newer.

Once you're ready, install via pip:

pip install harvest-python

Next, install the dependencies necessary for the brokerage of your choice:

pip install harvest-python[BROKER]

Replace BROKER with a brokerage/data source of your choice:

  • Robinhood
  • Alpaca
  • Webull
  • Kraken
  • Polygon

Now you're all set!

Contributing

Contributions are greatly appreciated. Check out the CONTRIBUTING document for details, and ABOUT 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.
  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. ↩

Metadata

Release files for harvest-python 0.4.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 harvest-python 0.4.0
File Size Uploaded Provenance Actions
harvest_python-0.4.0.tar.gz 98.4 kB Without provenance Details for harvest_python-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for harvest-python 0.4.0
File Interpreter ABI Platform Actions
harvest_python-0.4.0-py3-none-any.whl Python 3 none any Details for harvest_python-0.4.0-py3-none-any.whl

Total release size: 213.7 kB

Release files / harvest_python-0.4.0.tar.gz

Download URL harvest_python-0.4.0.tar.gz
Size 98.4 kB
Tags Source
SHA-256 checksum
How to use checksums
085dc0fd9085f970708a752f96c1d415ceaa959601f1ee36a0144ba0047abb1e
BLAKE2b-256 checksum
How to use checksums
7b574919b1274a2bdbe5630d3b33dcc056b0faee8421012bcf58ebcf28cf6f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / harvest_python-0.4.0-py3-none-any.whl

Download URL harvest_python-0.4.0-py3-none-any.whl
Size 115.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
302d0cd1db0c393af626fef446bbbcd1f899a56d2e2893b8cfe3d1e0684f309c
BLAKE2b-256 checksum
How to use checksums
182b450722b435e14aa0c85299eb9f9947b6ae0fadbc2a2ea4a66a7c9146f426
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Security for harvest-python 0.4.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.

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