binance-exchange / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to get price in binance.allOrders for type = MARKET & side = BUY/SELL

raman424 opened this issue · comments

When I am trying to get allOrders from the API, I am getting all the orders but not able to get the price when type = MARKET and side = BUY or SELL.

binance.allOrders('ETHUSDT', (error, orders, symbol) => {
    console.log(symbol+ " orders:", orders);
  });

Sample Result:

  { symbol: 'ETHUSDT',
    orderId:123456789,
    clientOrderId: 'web_someClientID',
    price: '0.00000000', // This is coming as zero where as expecting price value here.
    origQty: '1.00000000',
    executedQty: '1.00000000',
    status: 'FILLED',
    timeInForce: 'GTC',
    type: 'MARKET', // For type LIMIT, price is coming
    side: 'BUY',
    stopPrice: '0.00000000',
    icebergQty: '0.00000000',
    time: 1234567890,
    isWorking: true },

Am I missing something or there is some other way to get it?
Can you please help resolve the issue?

Regards

Hi there, using newOrderRespType with market orders will return much more detailed information.

newOrderRespType example

It returns an array of fills, so you can just take the first one, or create a cost average