IBContractTickerMapper¶
-
class
qf_lib.backtesting.contract.contract_to_ticker_conversion.ib_contract_ticker_mapper.
IBContractTickerMapper
(ticker_to_contract: Dict[qf_lib.common.tickers.tickers.Ticker, qf_lib.brokers.ib_broker.ib_contract.IBContract], data_provider: Optional[qf_lib.data_providers.data_provider.DataProvider] = None)[source]¶ Bases:
qf_lib.backtesting.contract.contract_to_ticker_conversion.base.ContractTickerMapper
IB IBContract mapper that can be used for live trading. Maps Tickers onto Interactive Brokers IBContract objects.
- Parameters
ticker_to_contract (Dict[Ticker, IBContract]) – mapping between Tickers (also FutureTickers) and parameters that should be used for these tickers, when transforming them into Contracts.
data_provider (Optional[DataProvider]) – data_provider used to obtain the value of the last trade date for various tickers. The parameter is optional and it is necessary only in case if the mapping between FutureTickers and Contracts is required.
Methods
contract_to_ticker
(contract)It always maps to the specific ticker.
ticker_to_contract
(ticker)Maps ticker to corresponding ticker.
-
contract_to_ticker
(contract: qf_lib.brokers.ib_broker.ib_contract.IBContract) → qf_lib.common.tickers.tickers.Ticker[source]¶ It always maps to the specific ticker.
-
ticker_to_contract
(ticker: qf_lib.common.tickers.tickers.Ticker) → qf_lib.brokers.ib_broker.ib_contract.IBContract[source]¶ Maps ticker to corresponding ticker.
- Parameters
ticker (Ticker) – ticker that should be mapped
- Returns
corresponding broker specific object
- Return type
Any