File: WebAPI/strategy_definition_2.proto
Message describing a synthetic, a user defined strategy or a native spread. It is a tree where terminal nodes (legs) are outright contracts, non-terminal ones are nested strategies. Nodes are defined from the BUY perspective.
Maximum strategy nesting level:
•Synthetic strategies: 2 (i.e. strategy of strategies of legs);
•Exchange strategies: depends only on exchange.
Maximum number of legs in the whole strategy:
•Synthetic strategies: 40;
•Exchange strategies: depends only on exchange.
Strategy trading operates with the node path in the tree of the strategy from the root to a leg or nested strategy node. The path is a string consisting of either StrategyDefinition.node_number or LegDefinition.node_number at every level of the tree preceded and separated by slash. Examples:
•“/” means the root strategy.
•“/1” means the leg or nested strategy with node_number 1 of the root strategy.
•“/1/2” means the leg or nested strategy with node_number 2 of a strategy S1, S1 is the strategy with node_number 1 of the root strategy.
•“/1/2/2” means the leg with node_number 2 of a strategy S1, S1 is the strategy with node_number 2 of another strategy S2, S2 is the strategy with node_number 1 of the root strategy.
ContractMetadata, NestedStrategy, StrategyDefinitionRequest
Type: bool
Description: The strategy is of the aggregation type.
Type: ExchangeStrategy
Description: If specified - defines exchange strategy (aka User Defined Spread/Strategy, UDS), otherwise - synthetic strategy.
Type: bool
Description: The strategy is a native spread (strategy).
Note: This field can only be set by server and cannot be used in StrategyDefinitionRequest.
Type: double
Description: Strategy tick size (correct price format). The tick size of the 1st leg is default.
Type: double
Description: Additive offset for computation of strategy price. 0 is default.
Type: uint32
Description: Controls how to handle fractional quantities when calculating leg quantities for an order on this strategy, One of RoundLegMode enums, ROUND_LEG_MODE_DOWN is default. Ignored for aggregations and exchange strategies.
Type: uint32
Description: Note: Use node_number instead.
Type: sint32
Description: Node number populated by server, unique between legs and nested strategies of the parent strategy, part of node_path field in order actions. Not set for the root strategy.
Type: StrategyNodeDefinition
Description: Legs or nested strategies.
Type: string
Description: User text associated with the strategy. Allowed to be specified only for non-exchange strategies.
Type: bool
Description: Whether the strategy is tradable (in general) or non-tradable. Non-tradable strategies cannot be used in order placement and any other trading operations, but can be used in synthetic calculations (for example, in time bar requests). True doesn’t mean the strategy is tradable right now (it can be expired or outside trading hours). False indicates the strategy is non-tradable ever. All exchange strategies are tradable, only synthetic strategies can be non-tradable. This field should not be provided in request.
Enum RoundLegMode
Description: Using a fractional trade ratio may result in fractional lots. If so, the number of lots must be rounded. Rounding applies only to complex strategies with fractional quantity ratios.
•ROUND_LEG_MODE_DOWN = 1
always round down, e.g., 1.1 -> 1 and -2.1 -> -2
•ROUND_LEG_MODE_UP = 2
always round up, e.g., 1.1 -> 2 and -2.1 -> -3
•ROUND_LEG_MODE_MATH = 3
round up when fractional part is 5 or greater; round down when fractional part is less than 5, e.g., 1.1 -> 1 and 1.6 -> 2