mobnetic / BitcoinChecker

DataModule for Bitcoin Checker android app
342 stars 212 forks source link

[Bug] Huobi doesn't update to current price #87

Closed Lycerion closed 10 years ago

Lycerion commented 10 years ago

All other exchanges work great, but any alarms set for Huobi have never worked for me (BTC or LTC). They display one set price and don't seem to update the current price, despite grabbing the correct bid/ask in the notification. Help?

MaciejCiemiega commented 10 years ago

Hello.

@"Huobi doesn't update to current price": Sorry but I don't understand what exactly the problem is. You've just said that the price is not updating. And in the next sentence you said that the price id downloaded fine, along with bid and ask values. + The notification is displayed, so it seems like all is working fine.

@"They display one set price and don't seem to update the current price". They = Huobi? If yes - I cannot make anything with it - these just data received from exchange. I'm not responsible for data provided directly from exchange so if the values are wrong you can submit an issue on their support system.

As you can see here: https://github.com/mobnetic/BitcoinChecker/blob/master/DataModule/src/com/mobnetic/coinguardian/model/market/Huobi.java Application make use of two links: https://market.huobi.com/staticmarket/detail.html https://market.huobi.com/staticmarket/detail_ltc.html And the last price value is provided in "p_last" object.

From what I can see everything works fine in Bitcoin Checker. Price id downloaded and it is the same that exchange sends to me.

BTW. I've not understand the part about alarms that don't work.

Greetings, MC.

Lycerion commented 10 years ago

Sorry for being a little vague, what I mean is that in the notification the bid and ask are correct with market price on the notification, but in the actual alarm page the current price doesn't seem to update to reflect those values, meaning the alarm doesn't go off most of the time. I can't think of why one would work but not the other... stumped. Note that it works for all other exchanges I've tried... so very strange.

Edit: Grabbed a screenshot of what I mean: http://i.imgur.com/yafIxQn.png

I've tried uninstalling/reinstalling the app to no avail.

MaciejCiemiega commented 10 years ago

I'm still confused:

  1. You said that the notification works fine, so why you've posted image of notification as a image that illustrates the problem?
  2. I think that I know what the problem is: There is no such thing like "current price" on alarm page. If you are reffering to the "Last checkpoint" value - this is not the current price of a checker. This is the last checkpoint for percentage alarm purposes. Percentage CHANGE (and also value CHANGE) alarm works that way it compares current price with some price from the past to calculate if the difference if greater(or lower) than X%. The point in time is called "checkpoint" and it is not updating with every price check. If it would update with every price check - the alarm would always compare the current price with previous price and it would probably never reach the X% difference, so it would never be triggered.

In checkpoint based alarms, the checkpoint is updated once alarm is triggered. Until the condition is not met (according to last checkpoint), the alarm will not be triggeres and the checkpoint value won't be updated.

If this is the problem you're reffering to - this is not a problem. It's just how "checkpoint based" alarms works. So if yes, I think the problem is with every other exchanges, because like you said "the checkpoint is updated after every check"? This is weird... Please confirm that it is 100% on your device so I will do some research what is going on.

Greetings, MC.

Lycerion commented 10 years ago

What I mean with the notification is that the subsection for "bid" and "ask" updates correctly, but "last price" is stuck at a seemingly random value. On my previous image for example, bid is 3996.13, ask is 3997.98. These are both correct, but the main "last price" says that it is 4039.00, which is wrong. If I create a checker with the same settings for bitfinex or bitstamp, this works correctly. I'm using "greater than x price" and "less than x price" for alarms, so it's probably not the checkpoint thing...

The problem is that alarms are triggered by the "last price", so because it doesn't update none of my huobi alarms go off.

http://i.imgur.com/46wCrR2.png when I captured this, the price was 4003cny, which is what the bid/ask shows, but it never updates the main price. :(

MaciejCiemiega commented 10 years ago

Ok, so the problem is only about the "Last" price. Does the same "Last" price is displayed in notification and in main application screen? How do you know that the "Last" price is incorrect? (Did you compare it wich one provided by exchange?)

Lycerion commented 10 years ago

Yes, same price is displayed on notification and checker screen, 4039. I think this might get stuck at whatever the price was when the checker was created. I know it is incorrect from watching different chart sites, and checking the exchanges orderbook. The odd thing is the bid and ask update to correct values, so it's nothing with the api...

MaciejCiemiega commented 10 years ago

So this is what I said in my first answer:

As you can see here: https://github.com/mobnetic/BitcoinChecker/blob/master/DataModule/src/com/mobnetic/coinguardian/model/market/Huobi.java Application make use of two links: https://market.huobi.com/staticmarket/detail.html https://market.huobi.com/staticmarket/detail_ltc.html And the last price value is provided in "p_last" object.

Such value is provided by the exchange and Bitcoin Checker shown this price without any issues.

If yes - I cannot make anything with it - these just data received from exchange. I'm not responsible for data provided directly from exchange so if the values are wrong you can submit an issue on their support system.

MaciejCiemiega commented 10 years ago

Note: If anything is working fine on one exchange and doesn't on other - the is 95% probability that this is not an application fault.

MaciejCiemiega commented 10 years ago

BTW. I can do some changes in handling Huobi in app, but this is their issue - as you can see in this link: https://market.huobi.com/staticmarket/detail.html the p_last price stays unchanged... So they have changed the behavior of that script. From what I can see they have released their new ticker API here: http://market.huobi.com/staticmarket/ticker_btc_json.js so I can use it to obtain the right price in next app version.

Lycerion commented 10 years ago

Ok, so it seems like p_last isn't giving the correct value... very strange. Admittedly I don't have much experience working with APIs, so I'm not sure why that would happen. I'll see if I can contact their English support and let them know, hehe.

Thanks for the help.

MaciejCiemiega commented 10 years ago

I think you don't need to contact their support anymore. As I've made some research and found their newly added Ticker API (that I've mentioned in last post): http://market.huobi.com/staticmarket/ticker_btc_json.js I hope that if I will switch application to read from that API everything will be good. I will try to implement this new API once I will be back at home and I will give you some status then:)

Greetings, MC.

MaciejCiemiega commented 10 years ago

Hello, It is working fine with the new version of API so this change will be included in next update of Bitcoin Checker. Greetings, MC.

Lycerion commented 10 years ago

Got a reply from their support: [7/3/2014 5:28:42 AM] huo bi: it is the last price of yesterday

Thanks for the quick fix.

MaciejCiemiega commented 10 years ago

I've included this change in update 1.3.8, just published on Google Play Store - it should go live within an hour.

Greetings, MC.