Skip to content

SecurityCurrencyConversion

QuantConnect.Securities.CurrencyConversion.SecurityCurrencyConversion

Bases: Object, ICurrencyConversion

Provides an implementation of ICurrencyConversion to find and use multi-leg currency conversions

conversion_rate_updated

conversion_rate_updated: _EventContainer[
    Callable[[Object, float], Any], Any
]

Event fired when the conversion rate is updated

source_currency

source_currency: str

The currency this conversion converts from

destination_currency

destination_currency: str

The currency this conversion converts to

conversion_rate

conversion_rate: float

The current conversion rate

conversion_rate_securities

conversion_rate_securities: Iterable[Security]

The securities which the conversion rate is based on

linear_search(
    source_currency: str,
    destination_currency: str,
    existing_securities: List[Security],
    potential_symbols: List[Symbol],
    make_new_security: Callable[[Symbol], Security],
) -> SecurityCurrencyConversion

Finds a conversion between two currencies by looking through all available 1 and 2-leg options

Parameters:

Name Type Description Default
source_currency str

The currency to convert from

required
destination_currency str

The currency to convert to

required
existing_securities List[Security]

The securities which are already added to the algorithm

required
potential_symbols List[Symbol]

The symbols to consider, may overlap with existing_securities

required
make_new_security Callable[[Symbol], Security]

The function to call when a symbol becomes part of the conversion, must return the security that will provide price data about the symbol

required

Returns:

Type Description
SecurityCurrencyConversion

A new SecurityCurrencyConversion instance representing the conversion from source_currency to destination_currency.

update

update() -> None

Signals an updates to the internal conversion rate based on the latest data. It will set the conversion rate as potentially outdated so it gets re-calculated.