Buy or Sell

Market data, Trading, Technical support, Features requests, etc
lnszmjhe
Posts: 19
Joined: Sat Feb 17, 2024 2:39 am

Buy or Sell

Post by lnszmjhe » Mon Feb 26, 2024 1:18 pm

How do I know if a certain contract in the Book is a purchase or sale contract?

lnszmjhe
Posts: 19
Joined: Sat Feb 17, 2024 2:39 am

Re: Buy or Sell

Post by lnszmjhe » Mon Feb 26, 2024 6:16 pm

Does anyone know how to do this?

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Buy or Sell

Post by Andry API support » Tue Feb 27, 2024 6:58 am

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.

lnszmjhe
Posts: 19
Joined: Sat Feb 17, 2024 2:39 am

Re: Buy or Sell

Post by lnszmjhe » Tue Feb 27, 2024 10:10 pm

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?

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Buy or Sell

Post by Andry API support » Wed Feb 28, 2024 5:18 pm

`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.

lnszmjhe
Posts: 19
Joined: Sat Feb 17, 2024 2:39 am

Re: Buy or Sell

Post by lnszmjhe » Wed Feb 28, 2024 7:32 pm

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?

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Buy or Sell

Post by Andry API support » Thu Feb 29, 2024 3:40 pm

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

lnszmjhe
Posts: 19
Joined: Sat Feb 17, 2024 2:39 am

Re: Buy or Sell

Post by lnszmjhe » Thu Feb 29, 2024 6:33 pm

So, in the onTrade() event, how do I identify when an order is limit or when it is a direct market order?

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Buy or Sell

Post by Andry API support » Fri Mar 01, 2024 7:00 am

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.

lnszmjhe
Posts: 19
Joined: Sat Feb 17, 2024 2:39 am

Re: Buy or Sell

Post by lnszmjhe » Mon Mar 04, 2024 2:50 pm

What is MBO, what is the concept of it and what other types of data exist on the platform?

Post Reply