Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

getFills API returns data in unexpected format #259

Closed
adityamertia opened this issue Feb 5, 2018 · 3 comments
Closed

getFills API returns data in unexpected format #259

adityamertia opened this issue Feb 5, 2018 · 3 comments

Comments

@adityamertia
Copy link
Contributor

Hi,
While calling getFills API with order_id param it returns data in unexpected format as below:

{
	"statusCode": 200,
	"body": "[{\"created_at\":\"2018-02-05T15:43:38.908Z\",\"trade_id\":3525742,\"product_id\":\"LTC-BTC\",\"order_id\":\"1b5cdf72-f829-4b0d-ae7b-b3bd2cf59052\",\"user_id\":\"59a96c25797a740156eec37d\",\"profile_id\":\"774234da-b2bb-4e88-9c9a-8dc7048835b8\",\"liquidity\":\"T\",\"price\":\"0.01812000\",\"size\":\"0.20000000\",\"fee\":\"0.0000108720000000\",\"side\":\"sell\",\"settled\":true,\"usd_volume\":\"26.8360000000000000\"}]",
	"headers": {
		"date": "Mon, 05 Feb 2018 15:43:40 GMT",
		"content-type": "application/json; charset=utf-8",
		"content-length"

Is order_id param not allowed as of now in getFills API or the API is broken ?
Fills response should be returned as below:

[
    {
        "trade_id": 74,
        "product_id": "BTC-USD",
        "price": "10.00",
        "size": "0.01",
        "order_id": "d50ec984-77a8-460a-b958-66f114b0de9b",
        "created_at": "2014-11-07T22:19:28.578544Z",
        "liquidity": "T",
        "fee": "0.00025",
        "settled": true,
        "side": "buy"
    }
]
@rmm5t
Copy link
Contributor

rmm5t commented Feb 5, 2018

Pasting results without pasting the code that got you there is a bit dubious.

However, it sounds like you're using the callback signature, but not using the callback correctly (similar to #244): Your code should look like this:

const order_id = 'd50ec984-77a8-460a-b958-66f114b0de9b';
client.getFills({ order_id }, (err, response, data) => console.log(data));

Or better yet, start using promises:

client.getFills({ order_id }).then(console.log);

Please close this issue if this resolves your problem.

@rmm5t
Copy link
Contributor

rmm5t commented Feb 5, 2018

Also relevant is this proposal/discussion: #86 (comment)

@adityamertia
Copy link
Contributor Author

Thanks for clarifying.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants