Simple and intuitive python framework for algorithmic trading.
Project description
Harvest is a simple yet flexible Python framework for algorithmic trading. Paper trade and live trade stocks, cryptos, and options![^1][^2] Visit here for tutorials and documentation.
⚠️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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file harvest_python-0.4.0.tar.gz
.
File metadata
- Download URL: harvest_python-0.4.0.tar.gz
- Upload date:
- Size: 98.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 085dc0fd9085f970708a752f96c1d415ceaa959601f1ee36a0144ba0047abb1e |
|
MD5 | 61c3e7f3f2b8e75097c990887ea37e63 |
|
BLAKE2b-256 | 7b574919b1274a2bdbe5630d3b33dcc056b0faee8421012bcf58ebcf28cf6f33 |
File details
Details for the file harvest_python-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: harvest_python-0.4.0-py3-none-any.whl
- Upload date:
- Size: 115.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 302d0cd1db0c393af626fef446bbbcd1f899a56d2e2893b8cfe3d1e0684f309c |
|
MD5 | e7f78c769ff37edd78c867c324ac14bb |
|
BLAKE2b-256 | 182b450722b435e14aa0c85299eb9f9947b6ae0fadbc2a2ea4a66a7c9146f426 |