BitShares Forum

Main => Technical Support => Topic started by: monsterer on October 08, 2014, 09:51:08 am

Title: blockchain_market_price_history returns bizarre number of decimal places
Post by: monsterer on October 08, 2014, 09:51:08 am
Im getting:

Code: [Select]
{"timestamp":"20141004T000000","highest_bid":0.032679738562091512,"lowest_ask":0.030519999755840001,"opening_price":0.032880567913168998,"closing_price":0.032880567913168998,"volume":99851850031,"recent_average_price":null}
When calling

Code: [Select]
blockchain_market_price_hostory ["USD","BTSX","20141003T000000",86400,"each_day"]
That's 18 decimal places for a price quoted in USD, when USD precision is 10000, which corresponds to 4 decimal places?

Cheers, Paul.
Title: Re: blockchain_market_price_history returns bizarre number of decimal places
Post by: modprobe on October 13, 2014, 01:23:14 pm
This is not a bug. Prices are defined to have pretty much arbitrarily high precision, as they represent the ratio between two assets, meaning the price needs greater precision than either asset. This command is not intended to be used by humans anyways (except for debugging) so whatever client code is calling it can do any rounding it needs to do.