blockchain_market_price_history last parameter accepts only 0->2 [solved]

Started by monsterer, October 07, 2014, 08:37:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

monsterer

Quote from: modprobe on October 13, 2014, 01:26:57 PM
Yes, to get fc to interpret the enum name as the appropriate value, it must be enclosed in double-quotes. This is a quirk of how we do the argument parsing (everything is JSON) and there's no good way to fix it.

Why not just auto enclose all parameters in quotes when they're received?
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

modprobe

Yes, to get fc to interpret the enum name as the appropriate value, it must be enclosed in double-quotes. This is a quirk of how we do the argument parsing (everything is JSON) and there's no good way to fix it.

monsterer

Quote from: svk on October 08, 2014, 08:31:23 AM
I'm using it in an RPC call but I'm not explicitly serialising anything, although the library I'm using might do so behind the scenes I suppose. I played around with the CLI to figure out how to structure the command though, and I always just passed "each_hour" or "each_day" etc. I don't have access to the client since I'm at work, but will have a look later.

Are you passing the string each_hour enclosed like so:

blockchain_market_price_history USD BTSX 20141003T220010 86400 "each_hour"


You're right - it just needed the quotes :)
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

svk

Quote from: monsterer on October 08, 2014, 08:05:55 AM
Quote from: svk on October 07, 2014, 09:11:25 PM
Pretty sure I'm using "each_hour" without issue on my backend.

I'm guessing that your json serialisation is set to serialise the value of enums, rather than the identifier?

You can confirm the behaviour in the client console.

Cheers, Paul.

I'm using it in an RPC call but I'm not explicitly serialising anything, although the library I'm using might do so behind the scenes I suppose. I played around with the CLI to figure out how to structure the command though, and I always just passed "each_hour" or "each_day" etc. I don't have access to the client since I'm at work, but will have a look later.

Are you passing the string each_hour enclosed like so:

blockchain_market_price_history USD BTSX 20141003T220010 86400 "each_hour"


Worker: dev.bitsharesblocks

monsterer

Quote from: svk on October 07, 2014, 09:11:25 PM
Pretty sure I'm using "each_hour" without issue on my backend.

I'm guessing that your json serialisation is set to serialise the value of enums, rather than the identifier?

You can confirm the behaviour in the client console.

Cheers, Paul.
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

svk

Worker: dev.bitsharesblocks

monsterer

Quote from: xeroc on October 07, 2014, 08:49:17 PM
Good to know someone figured it out ..
I also tried around with this cmd but could get any results :(

could you be so kind and give as a full example?

The trick is to mess up the timestamp formatting; instead of yyyy/MM/ddTHH:mm:ff, you should pass yyyyMMddTHHmmff.

blockchain_market_price_history USD BTSX 20141003T220010 86400 2

Will return 24 hour granularity on USD BTSX with a start date of oct 3rd, 22:00:10

Hope that helps!

Cheers, Paul.
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

xeroc

Quote from: monsterer on October 07, 2014, 08:37:43 PM
blockchain_market_price_history is documented as accepting a string: each_block, each_hour or each_day for the granularity parameter. In actual fact, it only accepts the enum definitions of 0,1,2.

Cheers, Paul.
Good to know someone figured it out ..
I also tried around with this cmd but could get any results :(

could you be so kind and give as a full example?

monsterer

blockchain_market_price_history is documented as accepting a string: each_block, each_hour or each_day for the granularity parameter. In actual fact, it only accepts the enum definitions of 0,1,2.

Cheers, Paul.
My opinions do not represent those of metaexchange unless explicitly stated.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads