Longbridge OpenAPI C++ SDK
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
longbridge::grid::GridTradeRule Struct Reference

#include <types.hpp>

Public Member Functions

GridTradeRulewith_limit_events (GridLimitEvent upper, GridLimitEvent lower)
 Set the actions taken at the upper / lower bounds. More...
 
GridTradeRulewith_depths (int32_t sell, int32_t buy)
 Set the sell / buy order-book depths (0 = use the order type). More...
 
GridTradeRulewith_order_types (std::string up, std::string down)
 Set the sell / buy order types (GMO / GLO / GTG). More...
 
GridTradeRulewith_multiple_trigger (bool value)
 Allow a single grid level to trigger multiple times. More...
 
GridTradeRulewith_support_shortsell (bool value)
 Allow short selling. More...
 
GridTradeRulewith_rth (int32_t value)
 Set the regular-trading-hours flag (0 / 1 / 2). More...
 
GridTradeRulewith_expire_time (int64_t unix_seconds)
 Set the expiry time (unix seconds), used with a GTD time-in-force. More...
 

Static Public Member Functions

static GridTradeRule create (Decimal base_price, Decimal upper_price, Decimal lower_price, GridTrigger trigger, Decimal quantity, Decimal upper_quantity, Decimal lower_quantity, GridTimeInForce time_in_force)
 

Public Attributes

std::optional< Decimalsubmitted_base_price
 Base price the grid is anchored to. More...
 
std::optional< Decimalupper_limit_price
 Upper price bound. More...
 
std::optional< Decimallower_limit_price
 Lower price bound. More...
 
std::optional< TriggerPriceTypetrigger_price_type
 Trigger price type (only Spread / Percent allowed) More...
 
std::optional< Decimaltrigger_spread_up
 Upward trigger spread (absolute) More...
 
std::optional< Decimaltrigger_spread_down
 Downward trigger spread (absolute) More...
 
std::optional< Decimaltrigger_percent_up
 Upward trigger percent. More...
 
std::optional< Decimaltrigger_percent_down
 Downward trigger percent. More...
 
std::optional< bool > multiple_trigger
 Whether a single grid level may trigger multiple times. More...
 
std::optional< GridTimeInForcetime_in_force
 Time in force (Day / GoodTilCanceled / GoodTilDate) More...
 
std::optional< Decimalupper_limit_quantity
 Quantity handled when the upper bound is reached. More...
 
std::optional< Decimallower_limit_quantity
 Quantity handled when the lower bound is reached. More...
 
std::optional< int64_t > expire_time
 Expiry time (unix seconds), used with GTD. More...
 
std::optional< GridLimitEventupper_limit_event
 
std::optional< GridLimitEventlower_limit_event
 
std::optional< int32_t > trigger_sell_depth
 Sell-side order-book depth (-5..5, 0 = use grid_order_type_up) More...
 
std::optional< int32_t > trigger_buy_depth
 Buy-side order-book depth (-5..5, 0 = use grid_order_type_down) More...
 
std::optional< Decimaltrigger_quantity
 Quantity per trigger. More...
 
std::optional< bool > support_shortsell
 Whether short selling is allowed. More...
 
std::optional< int32_t > rth
 Regular trading hours flag (0 / 1 / 2) More...
 
std::optional< std::string > grid_order_type_up
 Sell-side order type when depth is 0 (GMO / GLO / GTG) More...
 
std::optional< std::string > grid_order_type_down
 Buy-side order type when depth is 0 (GMO / GLO / GTG) More...
 

Detailed Description

Grid trading rule — parameters for submit / replace.

All fields are public and optional; use GridTradeRule::create to build a rule with the minimum required field set visible in the signature, then the fluent with_* setters for optional parameters.

Member Function Documentation

◆ create()

static GridTradeRule longbridge::grid::GridTradeRule::create ( Decimal  base_price,
Decimal  upper_price,
Decimal  lower_price,
GridTrigger  trigger,
Decimal  quantity,
Decimal  upper_quantity,
Decimal  lower_quantity,
GridTimeInForce  time_in_force 
)
inlinestatic

Create a rule with the fields a valid grid order requires. The gateway still validates business rules, but this makes the minimum field set visible in the signature instead of leaving all fields optional.

◆ with_depths()

GridTradeRule& longbridge::grid::GridTradeRule::with_depths ( int32_t  sell,
int32_t  buy 
)
inline

Set the sell / buy order-book depths (0 = use the order type).

◆ with_expire_time()

GridTradeRule& longbridge::grid::GridTradeRule::with_expire_time ( int64_t  unix_seconds)
inline

Set the expiry time (unix seconds), used with a GTD time-in-force.

◆ with_limit_events()

GridTradeRule& longbridge::grid::GridTradeRule::with_limit_events ( GridLimitEvent  upper,
GridLimitEvent  lower 
)
inline

Set the actions taken at the upper / lower bounds.

◆ with_multiple_trigger()

GridTradeRule& longbridge::grid::GridTradeRule::with_multiple_trigger ( bool  value)
inline

Allow a single grid level to trigger multiple times.

◆ with_order_types()

GridTradeRule& longbridge::grid::GridTradeRule::with_order_types ( std::string  up,
std::string  down 
)
inline

Set the sell / buy order types (GMO / GLO / GTG).

◆ with_rth()

GridTradeRule& longbridge::grid::GridTradeRule::with_rth ( int32_t  value)
inline

Set the regular-trading-hours flag (0 / 1 / 2).

◆ with_support_shortsell()

GridTradeRule& longbridge::grid::GridTradeRule::with_support_shortsell ( bool  value)
inline

Allow short selling.

Member Data Documentation

◆ expire_time

std::optional<int64_t> longbridge::grid::GridTradeRule::expire_time

Expiry time (unix seconds), used with GTD.

◆ grid_order_type_down

std::optional<std::string> longbridge::grid::GridTradeRule::grid_order_type_down

Buy-side order type when depth is 0 (GMO / GLO / GTG)

◆ grid_order_type_up

std::optional<std::string> longbridge::grid::GridTradeRule::grid_order_type_up

Sell-side order type when depth is 0 (GMO / GLO / GTG)

◆ lower_limit_event

std::optional<GridLimitEvent> longbridge::grid::GridTradeRule::lower_limit_event

Action when the lower bound is reached (only Ignore / CloseAtLast allowed)

◆ lower_limit_price

std::optional<Decimal> longbridge::grid::GridTradeRule::lower_limit_price

Lower price bound.

◆ lower_limit_quantity

std::optional<Decimal> longbridge::grid::GridTradeRule::lower_limit_quantity

Quantity handled when the lower bound is reached.

◆ multiple_trigger

std::optional<bool> longbridge::grid::GridTradeRule::multiple_trigger

Whether a single grid level may trigger multiple times.

◆ rth

std::optional<int32_t> longbridge::grid::GridTradeRule::rth

Regular trading hours flag (0 / 1 / 2)

◆ submitted_base_price

std::optional<Decimal> longbridge::grid::GridTradeRule::submitted_base_price

Base price the grid is anchored to.

◆ support_shortsell

std::optional<bool> longbridge::grid::GridTradeRule::support_shortsell

Whether short selling is allowed.

◆ time_in_force

std::optional<GridTimeInForce> longbridge::grid::GridTradeRule::time_in_force

Time in force (Day / GoodTilCanceled / GoodTilDate)

◆ trigger_buy_depth

std::optional<int32_t> longbridge::grid::GridTradeRule::trigger_buy_depth

Buy-side order-book depth (-5..5, 0 = use grid_order_type_down)

◆ trigger_percent_down

std::optional<Decimal> longbridge::grid::GridTradeRule::trigger_percent_down

Downward trigger percent.

◆ trigger_percent_up

std::optional<Decimal> longbridge::grid::GridTradeRule::trigger_percent_up

Upward trigger percent.

◆ trigger_price_type

std::optional<TriggerPriceType> longbridge::grid::GridTradeRule::trigger_price_type

Trigger price type (only Spread / Percent allowed)

◆ trigger_quantity

std::optional<Decimal> longbridge::grid::GridTradeRule::trigger_quantity

Quantity per trigger.

◆ trigger_sell_depth

std::optional<int32_t> longbridge::grid::GridTradeRule::trigger_sell_depth

Sell-side order-book depth (-5..5, 0 = use grid_order_type_up)

◆ trigger_spread_down

std::optional<Decimal> longbridge::grid::GridTradeRule::trigger_spread_down

Downward trigger spread (absolute)

◆ trigger_spread_up

std::optional<Decimal> longbridge::grid::GridTradeRule::trigger_spread_up

Upward trigger spread (absolute)

◆ upper_limit_event

std::optional<GridLimitEvent> longbridge::grid::GridTradeRule::upper_limit_event

Action when the upper bound is reached (only Ignore / CloseAtLast allowed)

◆ upper_limit_price

std::optional<Decimal> longbridge::grid::GridTradeRule::upper_limit_price

Upper price bound.

◆ upper_limit_quantity

std::optional<Decimal> longbridge::grid::GridTradeRule::upper_limit_quantity

Quantity handled when the upper bound is reached.


The documentation for this struct was generated from the following file: