gazbert / bxbot

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

Ticker info from trading api #81

Closed kgonia closed 6 years ago

kgonia commented 6 years ago

After short code review I see some limitations in implementing new strategies. From trading api we don't get info about open/high/low/volume only close price. It's impossible to implement strategies base on most stock indicators.

What about refactor getLatestMarketPrice to return Ticker or add another method signature to interface?

I'm able to to this but I want to figure out details.

gazbert commented 6 years ago

Yes, go for it! The bot started out as a simple hobby project to get trading on Bitcoin exchanges - it needs to grow up a bit now :-)

A new getTicker() op on the TradingAPI interface sounds like the way to go. A default no-op impl on the interface would mean we could upgrade each Exchange Adapter as and when folk get time to do it.

I'll assign the ticket to you. No rush for any of this stuff. Give me a shout if you need any help.

gazbert commented 6 years ago

How are you getting on with the Ticker? I've got some free time and could get it all done this weekend if you want?

kgonia commented 6 years ago

Nice work. Lately I've tested some strategies using https://github.com/ta4j/ta4j that was mentioned in https://github.com/gazbert/bxbot/issues/78

I think about efficient integration with ta4j. ta4j has own ticker interface https://github.com/ta4j/ta4j/blob/master/ta4j-core/src/main/java/org/ta4j/core/Tick.java

Maybe we should use this interface or add second method getTa4jTicker() ?

Also, next method in adapters would be needed - getHistoryData (if possible) to feed indicators (like macd, sma, ema etc.)

gazbert commented 6 years ago

Hi @KrzychuJedi - I'm closing this ticket so I can get the basic Ticker functionality released in 0.8.5 of the bot.

I'm not sure about being dependent on ta4j in the core bot and tying all the adapters to use it. Other folks might have different preferences for different ticker impls and things could get messy if we start adding more and more flavours into the Trading API. Will have a think, but feel free to open up another ticket etc... :-)

Given ticker info is public, it should be easy enough for strat devs to make calls to the exchange if they need more advanced exchange specific ticker info, e.g. GDAX.

As for getHistoryData(), if enough exchanges provide this info, I'd be happy for this to get added to the Trading API.

gazbert commented 6 years ago

Basic Ticker released.

darkstarwashere commented 6 years ago

<Given ticker info is public, it should be easy enough for strat devs to make calls to the exchange if they need more advanced exchange specific ticker info, e.g. GDAX.

As for getHistoryData(), if enough exchanges provide this info, I'd be happy for this to get added to the Trading API.>

I agree with you on this completely. I added my own using a different layout and hand coding was the best option long term. I am also working on a database piece that allows me to make changes on the fly without the need to restart the services. I have to bend like a blade of grass in the wind as the stocks do..... All data would be recorded to the database. Then data can be processed in many different ways. After which the sql service parses the data back using in line queries or calling stored procedures.