Author Topic: "get_trade_history" API call  (Read 997 times)

0 Members and 1 Guest are viewing this topic.

Offline bilthon

"get_trade_history" API call
« on: December 22, 2016, 08:23:28 pm »
Hello there, I'm trying to figure out exactly how to use the 'get_trade_history' database API call. The documentation seems to be a bit off for this one, since the order of the arguments displayed here http://docs.bitshares.org/api/database.html seems to be wrong.

Taking a look at the graphene code itself, I can find at /libraries/app/database_api.cpp:110 the following:

Code: [Select]
vector<market_trade> get_trade_history( const string& base, const string& quote, fc::time_point_sec start, fc::time_point_sec stop, unsigned limit = 100 )const;
But this is kind of at odds with what I actually find when querying the API, since it seems to be expecting a date format.

Connecting directly to a via wscat I get the following:

Code: [Select]
> {"id":1,"method":"call","params":[0,"get_trade_history",["BTS","EUR","20161215T0130000","20161212T233000", 100]],"jsonrpc":"2.0"}
< {"id":1,"result":[]}

And no, reverting the start and stop values doesn't seem to change anything either. Same result. Can anyone give me a hand with this?

Nelson

Offline ElMato

  • Sr. Member
  • ****
  • Posts: 288
    • View Profile
Re: &quot;get_trade_history&quot; API call
« Reply #1 on: December 27, 2016, 08:15:56 am »
Hello there, I'm trying to figure out exactly how to use the 'get_trade_history' database API call. The documentation seems to be a bit off for this one, since the order of the arguments displayed here http://docs.bitshares.org/api/database.html seems to be wrong.

Taking a look at the graphene code itself, I can find at /libraries/app/database_api.cpp:110 the following:

Code: [Select]
vector<market_trade> get_trade_history( const string& base, const string& quote, fc::time_point_sec start, fc::time_point_sec stop, unsigned limit = 100 )const;
But this is kind of at odds with what I actually find when querying the API, since it seems to be expecting a date format.

Connecting directly to a via wscat I get the following:

Code: [Select]
> {"id":1,"method":"call","params":[0,"get_trade_history",["BTS","EUR","20161215T0130000","20161212T233000", 100]],"jsonrpc":"2.0"}
< {"id":1,"result":[]}

And no, reverting the start and stop values doesn't seem to change anything either. Same result. Can anyone give me a hand with this?

Nelson
 /**

* A lower resolution time_point accurate only to seconds from 1970

*/

  class time_point_sec

  {
...

From
https://github.com/cryptonomex/fc/blob/master/include/fc/time.hpp


Sent from my XT1063 using Tapatalk