Simple and intuitive python framework for algorithmic trading.
Project description
Harvest is a Python based framework providing a simple and intuitive framework for algorithmic trading. Visit Harvest's website for details, tutorials, and documentation.
⚠️WARNING⚠️ Harvest is currently at v0.1. The program is unstable and cointains many bugs. Use with caution, and contributions are greatly appreciated.
Example
Below is a minimal example of a crossover strategy for TWTR
implemented with Harvest, tested on historical stock prices.
from harvest.algo import *
from harvest.trader import *
from harvest.api import *
class Watch(algo.BaseAlgo):
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()
if __name__ == "__main__":
t = tester.BackTester()
t.set_symbol('TWTR')
t.set_algo(Watch())
t.start()
If you want to see how this algorithm performs in real life, just change one line to enable paper trading:
- t = tester.BackTester()
+ t = trader.Trader()
Confident in your strategy? Deploy it using a broker of your choice (Currently only supports Robinhood). Again, you just need to change one line:
- t = trader.Trader()
+ t = trader.Trader(robinhood.Robinhood())
With Harvest, the process of testing, simulating, and deploying your strategies is a piece of cake 🍰
Installation
There are few prerequisites:
- git
- Python 3.8+
- pip
Harvest is still early in development, so you'll have to install it directly from this repo.
pip install -e 'git+https://github.com/tfukaza/harvest.git#egg=harvest'
Next, install the dependencies necessary for the brokerage of your choice. Currently, Harvest only supports Robinhood.
pip install -e 'git+https://github.com/tfukaza/harvest.git#egg=harvest[Robinhood]'
Now you're all set!
Contributing
Contributions are greatly appreciated. Check out the CONTRIBUTING document for details.
Disclaimer
- Harvest is not officially associated with Robinhood LLC.
- Robinhood was 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.
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
Hashes for harvest_algo-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7ff3a323209ef60fa9ad3ccd32d433b6a8a2d2a1cefb4c8ab2eeb60985cd720 |
|
MD5 | 5f4b2880b90c26fd35ee583be302877b |
|
BLAKE2b-256 | 748bef15db8750bab53c87d1c2d1e6e248b76b8772d230f63f1cc805a787c3b6 |