Skip to content

SymbolPropertiesDatabaseSymbolMapper

QuantConnect.Brokerages.SymbolPropertiesDatabaseSymbolMapper

SymbolPropertiesDatabaseSymbolMapper(market: str)

Bases: Object, ISymbolMapper

Provides the mapping between Lean symbols and brokerage symbols using the symbol properties database

Creates a new instance of the SymbolPropertiesDatabaseSymbolMapper class.

Parameters:

Name Type Description Default
market str

The Lean market

required

get_brokerage_security_type

get_brokerage_security_type(
    brokerage_symbol: str,
) -> SecurityType

Returns the security type for a brokerage symbol

Parameters:

Name Type Description Default
brokerage_symbol str

The brokerage symbol

required

Returns:

Type Description
SecurityType

The security type.

get_brokerage_symbol

get_brokerage_symbol(
    symbol: Union[Symbol, str, BaseContract],
) -> str

Converts a Lean symbol instance to a brokerage symbol

Parameters:

Name Type Description Default
symbol Union[Symbol, str, BaseContract]

A Lean symbol instance

required

Returns:

Type Description
str

The brokerage symbol.

get_lean_symbol

get_lean_symbol(
    brokerage_symbol: str,
    security_type: SecurityType,
    market: str,
    expiration_date: Union[datetime, date] = ...,
    strike: float = 0,
    option_right: OptionRight = ...,
) -> Symbol

Converts a brokerage symbol to a Lean symbol instance

Parameters:

Name Type Description Default
brokerage_symbol str

The brokerage symbol

required
security_type SecurityType

The security type

required
market str

The market

required
expiration_date Union[datetime, date]

Expiration date of the security(if applicable)

...
strike float

The strike of the security (if applicable)

0
option_right OptionRight

The option right of the security (if applicable)

...

Returns:

Type Description
Symbol

A new Lean Symbol instance.

is_known_brokerage_symbol

is_known_brokerage_symbol(brokerage_symbol: str) -> bool

Checks if the symbol is supported by the brokerage

Parameters:

Name Type Description Default
brokerage_symbol str

The brokerage symbol

required

Returns:

Type Description
bool

True if the brokerage supports the symbol.

is_known_lean_symbol

is_known_lean_symbol(
    symbol: Union[Symbol, str, BaseContract],
) -> bool

Checks if the Lean symbol is supported by the brokerage

Parameters:

Name Type Description Default
symbol Union[Symbol, str, BaseContract]

The Lean symbol

required

Returns:

Type Description
bool

True if the brokerage supports the symbol.