• C#
  • Java
  • VB
  • C++
  • Python
Contact us
IBKRATS Orders

Customers can direct non-marketable U.S. stock orders to the IBKRATS destination to add liquidity. Orders directed to IBKRATS are tagged as "not held" orders, and are posted in IBKR's order book where incoming SmartRouted orders from other IBKR customers are eligible to take liquidity by trading against them.
To route an order to IBKRATS via the API, you need to set the IBApi::Contract::Exchange field to "IBKRATS" and IBApi::Order::NotHeld to True, as shown below.

  • Contract contract = new Contract();
    contract.Symbol = "SPY";
    contract.SecType = "STK";
    contract.Exchange = "IBKRATS";
    contract.Currency = "USD";
    ...
    Order order = new Order();
    order.Action = action;
    order.OrderType = "LMT";
    order.LmtPrice = limitPrice;
    order.TotalQuantity = quantity;
    order.NotHeld = true;
    ...
    Order ibkratsOrder = OrderSamples.LimitIBKRATS("BUY", 100, 330);
    client.placeOrder(nextOrderId++, ContractSamples.IBKRATSContract(), ibkratsOrder);
  • Contract contract = new Contract();
    contract.symbol("SPY");
    contract.secType("STK");
    contract.exchange("IBKRATS");
    contract.currency("USD");
    ...
    Order order = new Order();
    order.action(action);
    order.orderType("LMT");
    order.lmtPrice(limitPrice);
    order.totalQuantity(quantity);
    order.notHeld(true);
    ...
    Order ibkratsOrder = OrderSamples.LimitIBKRATS("BUY", Decimal.ONE_HUNDRED, 330);
    client.placeOrder(nextOrderId++, ContractSamples.IBKRATSContract(), ibkratsOrder);
  • Dim contract As Contract = New Contract()
    contract.Symbol = "SPY"
    contract.SecType = "STK"
    contract.Exchange = "IBKRATS"
    contract.Currency = "USD"
    ...
    Dim order As Order = New Order
    order.Action = action
    order.OrderType = "LMT"
    order.LmtPrice = limitPrice
    order.TotalQuantity = quantity
    order.NotHeld = True
    ...
    Dim ibkratsOrder As Order = OrderSamples.LimitIBKRATS("BUY", 100, 330)
    client.placeOrder(increment(nextOrderId), ContractSamples.IBKRATSContract(), ibkratsOrder)
  • Contract contract;
    contract.symbol = "SPY";
    contract.secType = "STK";
    contract.exchange = "IBKRATS";
    contract.currency = "USD";
    ...
    Order order;
    order.action = action;
    order.orderType = "LMT";
    order.lmtPrice = limitPrice;
    order.totalQuantity = quantity;
    order.notHeld = true;
    ...
    Order ibkratsOrder = OrderSamples::LimitIBKRATS("BUY", DecimalFunctions::stringToDecimal("100"), 330);
    m_pClient->placeOrder(m_orderId++, ContractSamples::IBKRATSContract(), ibkratsOrder);
  • 1  contract = Contract()
    2  contract.symbol = "SPY"
    3  contract.secType = "STK"
    4  contract.currency = "USD"
    5  contract.exchange = "IBKRATS"
    ...
    1  order = Order()
    2  order.action = action
    3  order.orderType = "LMT"
    4  order.lmtPrice = limitPrice
    5  order.totalQuantity = quantity
    6  order.notHeld = True
    ...
    1  ibkratsOrder = OrderSamples.LimitIBKRATS("BUY", 100, 330)
    2  self.placeOrder(self.nextOrderId(), ContractSamples.IBKRATSContract(), ibkratsOrder)

IBKRATS order types

Pegged-to-Best

  • Order order = new Order();
    order.Action = action;
    order.OrderType = "PEG BEST";
    order.LmtPrice = limitPrice;
    order.TotalQuantity = quantity;
    order.NotHeld = true;
    order.MinTradeQty = minTradeQty;
    order.MinCompeteSize = minCompeteSize;
    order.CompeteAgainstBestOffset = competeAgainstBestOffset;
  • Order order = new Order();
    order.action(action);
    order.orderType("PEG BEST");
    order.lmtPrice(limitPrice);
    order.totalQuantity(quantity);
    order.notHeld(true);
    order.minTradeQty(minTradeQty);
    order.minCompeteSize(minCompeteSize);
    order.competeAgainstBestOffset(competeAgainstBestOffset);
  • Dim order As Order = New Order
    order.Action = action
    order.OrderType = "PEG BEST"
    order.LmtPrice = limitPrice
    order.TotalQuantity = quantity
    order.NotHeld = True
    order.MinTradeQty = minTradeQty
    order.MinCompeteSize = minCompeteSize
    order.CompeteAgainstBestOffset = competeAgainstBestOffset
  • Order order;
    order.action = action;
    order.orderType = "PEG BEST";
    order.lmtPrice = limitPrice;
    order.totalQuantity = quantity;
    order.notHeld = true;
    order.minTradeQty = minTradeQty;
    order.minCompeteSize = minCompeteSize;
    order.competeAgainstBestOffset = competeAgainstBestOffset;
  • 1  order = Order()
    2  order.action = action
    3  order.orderType = "PEG BEST"
    4  order.lmtPrice = limitPrice
    5  order.totalQuantity = quantity
    6  order.notHeld = True
    7  order.minTradeQty = minTradeQty
    8  order.minCompeteSize = minCompeteSize
    9  order.competeAgainstBestOffset = competeAgainstBestOffset

Pegged-to-Best offset difference

  • Order order = new Order();
    order.Action = action;
    order.OrderType = "PEG BEST";
    order.LmtPrice = limitPrice;
    order.TotalQuantity = quantity;
    order.NotHeld = true;
    order.MinTradeQty = minTradeQty;
    order.MinCompeteSize = minCompeteSize;
    order.CompeteAgainstBestOffset = Order.COMPETE_AGAINST_BEST_OFFSET_UP_TO_MID;
    order.MidOffsetAtWhole = midOffsetAtWhole;
    order.MidOffsetAtHalf = midOffsetAtHalf;
  • Order order = new Order();
    order.action(action);
    order.orderType("PEG BEST");
    order.lmtPrice(limitPrice);
    order.totalQuantity(quantity);
    order.notHeld(true);
    order.minTradeQty(minTradeQty);
    order.minCompeteSize(minCompeteSize);
    order.competeAgainstBestOffset(Order.COMPETE_AGAINST_BEST_OFFSET_UP_TO_MID);
    order.midOffsetAtWhole(midOffsetAtWhole);
    order.midOffsetAtHalf(midOffsetAtHalf);
  • Dim order As Order = New Order
    order.Action = action
    order.OrderType = "PEG BEST"
    order.LmtPrice = limitPrice
    order.TotalQuantity = quantity
    order.NotHeld = True
    order.MinTradeQty = minTradeQty
    order.MinCompeteSize = minCompeteSize
    order.CompeteAgainstBestOffset = Order.COMPETE_AGAINST_BEST_OFFSET_UP_TO_MID
    order.MidOffsetAtWhole = midOffsetAtWhole
    order.MidOffsetAtHalf = midOffsetAtHalf
  • Order order;
    order.action = action;
    order.orderType = "PEG BEST";
    order.lmtPrice = limitPrice;
    order.totalQuantity = quantity;
    order.notHeld = true;
    order.minTradeQty = minTradeQty;
    order.minCompeteSize = minCompeteSize;
    order.competeAgainstBestOffset = COMPETE_AGAINST_BEST_OFFSET_UP_TO_MID;
    order.midOffsetAtWhole = midOffsetAtWhole;
    order.midOffsetAtHalf = midOffsetAtHalf;
  • 1  order = Order()
    2  order.action = action
    3  order.orderType = "PEG BEST"
    4  order.lmtPrice = limitPrice
    5  order.totalQuantity = quantity
    6  order.notHeld = True
    7  order.minTradeQty = minTradeQty
    8  order.minCompeteSize = minCompeteSize
    9  order.competeAgainstBestOffset = COMPETE_AGAINST_BEST_OFFSET_UP_TO_MID
    10  order.midOffsetAtWhole = midOffsetAtWhole
    11  order.midOffsetAtHalf = midOffsetAtHalf

Pegged-to-Midpoint

  • Order order = new Order();
    order.Action = action;
    order.OrderType = "PEG MID";
    order.LmtPrice = limitPrice;
    order.TotalQuantity = quantity;
    order.NotHeld = true;
    order.MinTradeQty = minTradeQty;
    order.MidOffsetAtWhole = midOffsetAtWhole;
    order.MidOffsetAtHalf = midOffsetAtHalf;
  • Order order = new Order();
    order.action(action);
    order.orderType("PEG MID");
    order.lmtPrice(limitPrice);
    order.totalQuantity(quantity);
    order.notHeld(true);
    order.minTradeQty(minTradeQty);
    order.midOffsetAtWhole(midOffsetAtWhole);
    order.midOffsetAtHalf(midOffsetAtHalf);
  • Dim order As Order = New Order
    order.Action = action
    order.OrderType = "PEG MID"
    order.LmtPrice = limitPrice
    order.TotalQuantity = quantity
    order.NotHeld = True
    order.MinTradeQty = minTradeQty
    order.MidOffsetAtWhole = midOffsetAtWhole
    order.MidOffsetAtHalf = midOffsetAtHalf
  • Order order;
    order.action = action;
    order.orderType = "PEG MID";
    order.lmtPrice = limitPrice;
    order.totalQuantity = quantity;
    order.notHeld = true;
    order.minTradeQty = minTradeQty;
    order.midOffsetAtWhole = midOffsetAtWhole;
    order.midOffsetAtHalf = midOffsetAtHalf;
  • 1  order = Order()
    2  order.action = action
    3  order.orderType = "PEG MID"
    4  order.lmtPrice = limitPrice
    5  order.totalQuantity = quantity
    6  order.notHeld = True
    7  order.minTradeQty = minTradeQty
    8  order.midOffsetAtWhole = midOffsetAtWhole
    9  order.midOffsetAtHalf = midOffsetAtHalf

For further details on these orders, please see the following page: IBKRATS Orders

Note: The order must have the NotHeld field set to True, or you may receive a rejection with reason "IBKRAts order must be a not-held". When submitting via the TWS UI, this is set automatically.