tfukaza / harvest

Simple and intuitive Python framework for algorithmic trading. Easily create bots to live and paper trade stocks, crypto, and options!
https://tfukaza.github.io/harvest-website
MIT License
124 stars 26 forks source link

Split `DummyBroker` into `DummyStreamer` and `PaperBroker` #67

Closed tfukaza closed 3 years ago

tfukaza commented 3 years ago

Currently the functionality of DummyBroker is a little confusing - when used as a streamer, it generates dummy data as its name implies, but when used as a broker, it paper trades. Now that brokers have the mode attribute, DummyBroker should be split into separate brokers as described in the title.

Also, the following name convention is suggested for brokers:

shershah010 commented 3 years ago

How will we organize this? The dummy broker is based off the Robinhood broker which does both fetching data and buying and selling stocks. I don't think that the robinhood broker should be split and I though that each broker should follow its template..

tfukaza commented 3 years ago

E.g. if someone tries to use the Papertrader as a streamer it will give an error like "this broker only works as a brokerage, please use another broker or specify a streamer" I feel like we'll need this organization anyways since there are lot of apis out there that only work as a streamer like Polygon.Io

tfukaza commented 3 years ago

So Robinhoodbroker stays the way it is. I'm also working on a yahoo broker which is a streamer only broker so that'll be a good example

tfukaza commented 3 years ago

See #74 for an example of a streamer-only broker class

shershah010 commented 3 years ago

Since the broker and streamer have different functions to support would it be best to create a base streamer and a base broker and for brokers such as robinhood, it will inherit both broker and streamer?

tfukaza commented 3 years ago

I think we can do what I did for YahooStreamer, which is to just raise an Exception when an unsupported endpoint is called. We can also use the mode attribute to warn the user, for example when YahooStreamer is set as a broker.