gazbert / bxbot

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

Provide ticker history #86

Closed kgonia closed 5 years ago

kgonia commented 6 years ago

According to this discusion https://github.com/gazbert/bxbot/issues/81 I thinking about implementing findHistoryData() method.

Some stock indicators needs data from long period. It is not functional to wait until the data is collected in real time each time we start/test strategies.

Things to concern:

My propositions: Add HistoryDataService which be resposible for data saving and loading. In new module build simple app that will collect data independently from trading app. Save data in h2 db (least work with configuration).

It may require some refactoring like moving Ticket interface to other modules and make TickerImpl hibernate entity.

@darkstarwashere

darkstarwashere commented 6 years ago

Implementation of findHistoryData() method. I agree.

Long periods required by indicators. Correct no way around that and it must be stored for future/active queries.

Should we add findHistoryData() as part of trading api or separate service? I believe this should be a separate service. I believe this will allow for ease of growth and flexibility.

Which database should be included? I prefer to use MySQL which can be ported out to other database systems. I does have an overhead but we are going to require quick returns of data from various queries. This also allows for more complex queries based on technical analysis requirements. Once the various queries are built by users, one can store/compare results to validate BUY/SELL logic. As a basic example one could compare MACD, RSI and DMI values before making a decision or emailing the user about the data before commitment to the function BUY/SELL. As we know there is simply some logistics that should be reviewed by a human and this will allow for that. The data exported should be compatible with most databases so if users want to port data to a more simple database they can.

When we should collect data? The data would need to be collected using 1 minute intervals. ** I have not reviewed/compared data from different time intervals. Example 1 minute vs 1 day. This does make a large difference in the query results. I believe storing data at 1 minute intervals will allow the query scope to be modified for 1 minute, 5 minute, 15 minute intervals. We would need to review the results to ensure the solutions of the queries are accurate and make any adjustment if the expected values are not accurate.

Add HistoryDataService which be responsible for data saving and loading. In new module build simple app that will collect data independently from trading app. Save data in h2 db (least work with configuration).

I agree.

It may require some refactoring like moving Ticket interface to other modules and make TickerImpl hibernate entity.

I have not reviewed the code enough to comment on this one, but you would know better than I. This ticker processing system is the heart of the decision making process. Flexibility to access all stored data for the indicators is critical.

I am reviewing this API at the moment: https://www.tradingview.com/rest-api-spec/

@KrzychuJedi

gazbert commented 6 years ago

Yup, I think this should be a separate service and a separate app too - strategies could use this new app/service directly via a REST API and/or a Java API. Sounds like a cool new project to me!

It doesn't feel right to bundle it within BX-bot - it should be a microservice in its own right. But feel free to fork a BX-bot v2 and go for it if you think otherwise :-)

This bot might be a bit too simple for you guys - it started out as a Bitcoin trading learning/hobby project and might have served its purpose by now. Have you taken a look at Tim Molter's XChange project ? It provides a much richer trading API and covers a lot more exchanges - I'd use this if I was starting out now along with ta4j for the strats.

gazbert commented 5 years ago

Closing. No progress made. Can be resurrected if needed :-)