Page 1 of 2

Buy or Sell

Posted: Mon Feb 26, 2024 1:18 pm
by lnszmjhe
How do I know if a certain contract in the Book is a purchase or sale contract?

Re: Buy or Sell

Posted: Mon Feb 26, 2024 6:16 pm
by lnszmjhe
Does anyone know how to do this?

Re: Buy or Sell

Posted: Tue Feb 27, 2024 6:58 am
by Andry API support
Hi, if your question has to do with Bookmap API and MBO data, you can use MarketByOrderDepthDataListener in Simplified API which has isBid flag in its `send` method.
If not, please give more details about your case.

Re: Buy or Sell

Posted: Tue Feb 27, 2024 10:10 pm
by lnszmjhe
Hi Andy,
Yes, I want to know about Bookmap API and MBO.
In this case, in the onTrade(double price, int size, TradeInfo tradeInfo) event, how can I know if a certain trader is Buying or Selling?
I found "tradeInfo.isBidAggressor", but I don't know exactly what that field means.
In this event onTrade(), are all displayed orders "market executed" or do "pending orders" also go through here?

Re: Buy or Sell

Posted: Wed Feb 28, 2024 5:18 pm
by Andry API support
`tradeInfo.isBidAggressor`
a bid is a buyer, an ask is a seller. An aggressor here is a (typically) market order that gets executed against a limit order.
So if tradeInfo.isBidAggressor == true , it means a market buy order has been executed to a limit sell order.
onTrade gets triggered with trades (execution) events.
Please clarify what you mean by pending orders.

Re: Buy or Sell

Posted: Wed Feb 28, 2024 7:32 pm
by lnszmjhe
Hi Andry, thank you for your response.
What I called pending orders are limit sell order or limit buy order.

From what I read, the onDepth() event only deals with buy or sell limit orders, is that correct?

But when these orders limit sell or buy are launched, they go through the onTrade() event too?

Re: Buy or Sell

Posted: Thu Feb 29, 2024 3:40 pm
by Andry API support
For non-MBO data, DepthDataListener#onDepth deals with limit orders, right. But it does show changes to price levels volume rather than individual orders.
For MBO data you may use MboDataListener which deals with each order individually.
But when these orders limit sell or buy are launched, they go through the onTrade() event too?
Yes

Re: Buy or Sell

Posted: Thu Feb 29, 2024 6:33 pm
by lnszmjhe
So, in the onTrade() event, how do I identify when an order is limit or when it is a direct market order?

Re: Buy or Sell

Posted: Fri Mar 01, 2024 7:00 am
by Andry API support
TradeInfo#passiveOrderId is a limit order's id.
TradeInfo#aggressorOrderId is a market order's id.
These values will be null if the data is not MBO.

Re: Buy or Sell

Posted: Mon Mar 04, 2024 2:50 pm
by lnszmjhe
What is MBO, what is the concept of it and what other types of data exist on the platform?