Coder Social home page Coder Social logo

ryang20718 / harvest Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tfukaza/harvest

0.0 0.0 0.0 1.82 MB

Simple and intuitive Python framework for algorithmic trading. Easily create bots to live and paper trade stocks, crypto, and options!

Home Page: https://tfukaza.github.io/harvest-website

License: MIT License

JavaScript 1.50% Python 97.52% CSS 0.22% HTML 0.58% Svelte 0.18%

harvest's Introduction

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.

Footnotes

  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.

harvest's People

Contributors

tfukaza avatar shershah010 avatar alexonab avatar kimeiga avatar titaniayuki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.