IBContractTickerMapper

class qf_lib.backtesting.contract.contract_to_ticker_conversion.ib_contract_ticker_mapper.IBContractTickerMapper(ticker_to_contract: Dict[Ticker, IBContract], data_provider: Optional[DataProvider] = None)[source]

Bases: 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: IBContract) Ticker[source]

It always maps to the specific ticker.

ticker_to_contract(ticker: Ticker) IBContract[source]

Maps ticker to corresponding ticker.

Parameters:

ticker (Ticker) – ticker that should be mapped

Returns:

corresponding broker specific object

Return type:

Any