QuoteOneSide

An algorithm that quotes one side of a market by joining the passive side within a specified number of ticks, with the option to improve the market by one tick to gain queue priority.

The algo is similar to a limit order on the surface, but provides additional execution functionality in a couple of critical ways:

  • This algo will always put out a limit order with a price that is equal to or less aggressive than the set limit price

  • However, it will attempt to only post liquidity, so it will not cross the market unless the market moves toward the order while the order is in flight. In the JOIN mode, it joins the best bid (when buying) or offer (when selling)

  • It can be parameterized with the IMPROVE mode to improve the market by one tick to gain queue priority, as long as the price is less aggressive than the limit price

The algorithm continuously monitors the market and repositions the quote as needed to maintain competitiveness while respecting the specified constraints. It will have at most one order at a time out in the market.

Use Cases

  • While executing passively, to get filled at favorable prices without crossing the market

  • While spread trading, to quote the passive side of a spread while maintaining price competitiveness

  • While market making, to provide liquidity to one side of the market

QuoteOneSideParams

Parameter
Description

dir (OrderDir)

Designate your order as buy or sell with the binary enums OrderDir.BUY or OrderDir.SELL

quantity (decimal)

The quantity to execute. The algorithm terminates when filled to the nearest lot less than or equal to quantity

limit_price (decimal)

The most aggressive price the algo will quote at

max_ticks_outside (decimal)

Maximum number of ticks less aggressive than the BBO to quote

  • None: No constraint on distance from BBO — will quote at any valid price up to the limit price

  • n: Will only quote if within n ticks of the best same-side price (BBO)

Orders beyond this distance are cancelled as they're unlikely to fill

  • Example: With 5 for a buy order, if best bid is 100, will only quote between 95-100

This must be a positive integer

improve_or_join (ImproveOrJoin)

Designate whether to improve the market or join at the current best price with the binary enums ImproveOrJoin.Join or ImproveOrJoin.Improve

quantity_filled (decimal)

This is used to synchronize and track fill quantities when modifying the QuoteOneSide algo. Set it to 0 if initiating a new algo order

symbol (str)

marketdata_venue (str)

exchange_venue (str)

account (str, optional)

QuoteOneSideStatus

Field
Description

front_of_queue

Indicates whether the current quote is at the front of the queue (best price on our side). Being front of queue provides priority for fills.

  • For Buy orders: true when our quote price > previous best bid on the market

  • For Sell orders: true when our quote price < previous best ask on the market

  • Also true when we're the first to establish a quote on our side (no existing bid/ask)

This status updates dynamically as market conditions change and other orders arrive/cancel

is_cancelling

Indicates whether the algorithm is currently cancelling an order

orders_sent

Number of orders sent by the algo

quantity_filled

Quantity filled by the algo

current_quote_price

The active quote price

realized_avg_price

The average filled price of the algo

Example

from architect_py import QuoteOneSideParams, ImproveOrJoin, OrderDir

symbol = "NQ 20251219 CME Future"
tp = f"{symbol}/USD"
venue = "CME"
account="PAPER:[email protected]"
params = QuoteOneSideParams.new(
    dir=OrderDir.BUY,
    execution_venue=venue,
    marketdata_venue=venue,
    quantity_filled=0,
    improve_or_join=ImproveOrJoin.Join,
    limit_price = 26000,
    quantity=1,
    symbol=tp,
)
order = await client.place_algo_order(params=params, account=account)

API Reference

Last updated