Leg Configuration

The configuration for each leg defines the spread as a whole. They also allow customization of each leg's individual execution behavior

Spreads are defined by a weighted sum of the individual leg's prices, using price_multiplier, with an optional price_offset.

SpreadPrice=i=1nPriceMultiplieri(Pricei+PriceOffset)SpreadPrice =\sum_{i=1}^n PriceMultiplier_i * (Price_i + PriceOffset)

The quantity_ratio actually determines the ratio of contracts quantities you are trading in each leg. Most of the time, the quantity_ratio should be equal to price_multiplier. However, there are some instances where you may want the quantity_ratio to differ, such as when there are contract point values at play. For example, imagine a ES - MES spread. While you may wish to price it as long 1 ES, short 1 MES (price_multiplier of 1 and -1, respectively), ES has a contract point value of $50, whereas MES has one of $5. This means that to actually achieve the correct notional exposure that matches your long 1 ES, short 1 MES spread price, you would need to use a quantity_ratio of 1 and -10. Any multiple of this ratio, such as 0.1 and -1 works the same.

For another example, take Heating-Oil (HO) vs Gasoil (G): - HO is priced in $ / per gallon, G is priced in $ / metric ton - HO contract size is 42,000 gallons, G contract size is 100 metric tons

If we want to standardize the units of these two contracts and trade the resulting spread, we could set: - 1 gallon of heating oil is around 0.00318 metric tons, so the price_multiplier would be 1 HO x -0.00318 G - 42,000 gallons of heating oil is around 133.56 metric tons, so a quantity_ratio of 3 HO x -4 G would yield a similar tonnage (~400 vs 400 metric tons)

The sign of your price_multiplier for each leg must match that of your quantity_ratio , as the algo needs to take into account the buy/sell direction of your order to price using the corresponding bid/ask.

Fractional units can be given, but quantities will be rounded down if they cannot be rounded to a whole lot.

LegParams

Parameter
Description

price_multiplier (decimal)

The weight to assign to this leg for spread pricing

quantity_ratio (decimal)

The quantity ratio of contracts to trade this leg with respect to a spread unit. Note that when a spread quote or take order hits the market, quantity_ratio determines your legs' relative order sizing, not the price_multiplier, as the latter is only used for the spread pricing

price_offset (decimal)

The offset to apply to this leg before weighing it with price_multiplier. This might be used if there is some bias, costs or other adjustment you wish to make to this leg's price before computing the overall spread price

chase_ticks (unsigned integer)

The number of ticks more aggressive than the desired price for a taking order. Using chase_ticks > 0 decreases your changes of "getting hung", or remaining unhedged relative to the spread, after another leg gets a fill. However, when chase_ticks > 0, it is possible to get filled at a spread price that is worse than your limit price

quoting_parameters (QuotingParameters, optional)

Specify optional quoting parameters (see below). If not specified or left as None, this leg will not quote

symbol (str)

marketdata_venue (str)

execution_venue (str)

account (str)

QuotingParameters

Under the hood, Spreader utilizes the QuoteOneSide algo for smart quoting behavior, if the quoting_parameters field is specified.

Parameter
Description

max_quote_quantity (decimal, optional)

Maximum quantity to quote at a time for this leg. If left as None, the quantity quoted will be the minimum of the posted liquidity on the other leg, or the remaining quantity to satisfy the spreader order

Last updated