BitBotFactory / MikaLendingBot

Automated lending on Cryptocurrency exchanges Poloniex and Bitfinex
http://poloniexlendingbot.readthedocs.io/en/latest/index.html
MIT License
1.11k stars 344 forks source link

Plugin AccountStats / Charts - Inaccurate data for Poloniex (API Issue) #521

Open utdrmac opened 7 years ago

utdrmac commented 7 years ago

Poloniex doesn't return complete data when using their API. I've opened several tickets with them. You can test this yourself by calling 'returnLendingHistory' for date X thru Y and do the same in poloniex.com/tradeHistory (change type to Lending Earnings). You'll see stark differences between the two.

Because of this, charts and accountstats plugins will show inaccurate data.

Not sure how to get accurate data.

rnevet commented 7 years ago

The only idea I had was since Polo loans have IDs is to do different overlapping repeated requests till you don't get any new ids.

utdrmac commented 7 years ago

Hrm. I haven't tested that. Will give it a shot. Repeated API calls with the same dates gives same missing results.

utdrmac commented 7 years ago

As an FYI, Bittrex is spot on. If you manually download the CSV from their web UI and compare to what is in the SQLite db, it's the same data.

rnevet commented 7 years ago

I assumed this was a Poloniex issue... :( The entire code is over complicated because of the weird responses.

quantroom-pro commented 7 years ago

As i understand - i have the same issue. If delete DB and restart poloniex - first stats is ok. But when you fetch data next time it show strange values. As example - mean day earnings 10000 satoshi, but it show something like: 0.00000608 BTC Today 0.0000139 BTC Yesterday But if i will delete DB and restart bot, for the first time it will show actual values.

rnevet commented 7 years ago

@utdrmac last attempt, I'm assuming we are using the fetch history wrong and the start&end dates behavior is somehow effecting not only the close date but also the open dates.

I'm testing the following:

    def fetch_history(self, first_time_stamp, last_time_stamp):
        first_time_stamp = first_time_stamp - 172800

Basically add a 2 day offset to the start to catch. (this won't catch longer loans)

If this improves the results I need to re-think the way we perform the syncing of loans.

utdrmac commented 7 years ago

@rnevet Saw your slack. So you think the API is for open dates rather than closing?

rnevet commented 7 years ago

@utdrmac I'm not sure but it seems much more accurate with this patch.

laxdog commented 6 years ago

Can we close this @utdrmac / @rnevet ?

rnevet commented 6 years ago

No,. The issue is still there.