gazbert / bxbot

A simple Bitcoin trading bot written in Java.
MIT License
779 stars 275 forks source link

Strategies #78

Closed KosherBacon closed 6 years ago

KosherBacon commented 6 years ago

I was toying around with the code, and I'm curious how you'd go about a MACD strategy? I understand how the strategy itself works, but TradingStrategy and TradingApi don't provide ways to get some of that historical data. I could for example store lists of trades and run some algo over it. But this has the potential to miss a lot of trades.

Given that the bot only hits the exchange every 5 seconds or so, there could be trades missed that would render a MACD (or for that matter any strategy) wildly inaccurate.

Perhaps I'm missing something here, but is there a way to essentially get all of the orders since our last call to getLatestMarketPrice?

I know there are streaming api's and Java libraries that would allow a constant feed from exchanges such as GDAX. This would allow a strategy to have up to date information when its method execute is called.

Lastly, would you consider using something like ta4j (Java implementation for technical indicators)? It would allow the ability to use more complicated strategies without reinventing the wheel.

gazbert commented 6 years ago

A new Ticker is being added to the Trading API as part of #81

There's no plans for a websocket API at the moment - just simple REST API. Tim Molter's excellent https://github.com/timmolter/XChange project might worth looking into if you need a reactive Java integration capability with exchanges.

Yup, https://github.com/ta4j/ta4j is excellent - you can use this right now by adding it as a dependency in your strat project's POM/Gradle build file. Alternatively, if you want to park your strat in the bot's strat module, you can add the ta4j dependency in the bxbot-strategies POM/Gradle build file.

I've updated the README to include a link to ta4j instead of the Investopedia link too.

gazbert commented 6 years ago

Closing.

Ticker now provided as per #81

Simple example strat provided with bot, but see https://github.com/ta4j/ta4j and https://gitter.im/BX-bot/trading-strategies for more ideas...