Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

How to fetch a FULL order status #77

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

How to fetch a FULL order status #77

adityamertia opened this issue Feb 3, 2018 · 10 comments
Assignees

Comments

@adityamertia
Copy link

Hello,
I have been trying to fetch an orders status to look for the price and qty details from the fills. This as explained in the API docs can be fetch by using newOrderRespType ENUM.
newOrderRespType | ENUM | NO | Set the response JSON. ACK, RESULT, or FULL; default: RESULT.

binance.orderStatus(_SYMBOL_, orderID, newOrderRespType.FULL, function(err, orderStatus, symbol) {
       if(err)
         logger.info(`ERROR: ${err.message}`);
       else{ 
         logger.info(symbol + " order status:" + JSON.stringify(orderStatus));
       }
    });

But i get ReferenceError: newOrderRespType is not defined.
Can someone tell how to fetch FULL orderStatus as explained in the API doc @ https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md

@jaggedsoft
Copy link
Member

Right now it only supports symbol, orderid
I'll add the rest of the flags tonight

@jaggedsoft
Copy link
Member

Thanks for the report!

@jaggedsoft
Copy link
Member

The orderStatus function now supports newOrderRespType

orderStatus: function(symbol, orderid, callback, flags = {}) {
    let parameters = Object.assign({symbol:symbol, orderId:orderid}, flags);
    signedRequest(base+'v3/order', parameters, function(error, data) {
        if ( callback ) return callback.call(this, error, data, symbol);
    });
},

I'll update when the release is live

@jaggedsoft
Copy link
Member

binance.orderStatus(_SYMBOL_, orderID, function(err, orderStatus, symbol) {
       if(err)
         logger.info(`ERROR: ${err.message}`);
       else{ 
         logger.info(symbol + " order status:" + JSON.stringify(orderStatus));
       }
}, {newOrderRespType: 'FULL'});

@jaggedsoft
Copy link
Member

Available now in v0.4.11

@adityamertia
Copy link
Author

Above code didn't work even now. I get following error:
ERROR: "{\"code\":-1104,\"msg\":\"Not all sent parameters were read; read '5' parameter(s) but was sent '6'.\"}"

@jaggedsoft
Copy link
Member

newOrderRespType, as its name implies, must unfortunately only be available in new orders

@adityamertia
Copy link
Author

adityamertia commented Feb 4, 2018

@jaggedsoft I didn't quite get it. The documentation mentions it in newOrder creation API and not in orderStatus. But you have added this in orderStatus(as mentioned by you in above code snippet) and order status can only be checked for an order which was already placed. And once the order is completed then only there can be any use of FULL to check the details of the fills. There seems to be ambiguity in the documentation and actual implementation?
My requirement is to fetch the details of order fills, as i ultimately need the 'price' at which the order gets executed. using orderStatus i can get it by taking weighted avg of price and qty. Is there any other way of fetching the 'price'?

@adityamertia
Copy link
Author

@jaggedsoft any update on this?

@jaggedsoft
Copy link
Member

I'm afraid not, it appears the deficiency is on the binance side
But I can suggest they provide what you're after

It's also possible that one of these may provide what you want. But I'm not sure the difference between them yet

Recent Trades (historicalTrades, recentTrades, aggTrades functions)

binance.aggTrades("BNBBTC", {limit:500}, (error, response)=>{
	console.log("aggTrades", response);
});
binance.recentTrades("BNBBTC", (error, response)=>{
	console.log("recentTrades", response);
});
binance.historicalTrades("BNBBTC", (error, response)=>{
	console.log("historicalTrades", response);
});

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

No branches or pull requests

2 participants