ib_async.contract
Generated from the installed ib_async 2.1.0 package. Signatures and defaults are version-specific.
Financial instrument types used by Interactive Brokers.
Bag
Bag(**kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Bag
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Bag.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Bag.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Bag.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Bag.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Bond
Bond(**kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Bond
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Bond.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Bond.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Bond.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Bond.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
CFD
CFD(symbol: str = '', exchange: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.CFD
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.CFD.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.CFD.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.CFD.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.CFD.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
ComboLeg
ComboLeg(conId: int = 0, ratio: int = 0, action: str = '', exchange: str = '', openClose: int = 0, shortSaleSlot: int = 0, designatedLocation: str = '', exemptCode: int = -1) -> None
Completeness: signature-only · Canonical ID: ib_async.contract.ComboLeg
Runtime signature is published; semantic enrichment remains outstanding.
ComboLeg(conId: int = 0, ratio: int = 0, action: str = '', exchange: str = '', openClose: int = 0, shortSaleSlot: int = 0, designatedLocation: str = '', exemptCode: int = -1)
Fields
| Name | Type | Default |
|---|---|---|
conId | int | 0 |
ratio | int | 0 |
action | str | `` |
exchange | str | `` |
openClose | int | 0 |
shortSaleSlot | int | 0 |
designatedLocation | str | `` |
exemptCode | int | -1 |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.ComboLeg.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.ComboLeg.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.ComboLeg.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.ComboLeg.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Commodity
Commodity(symbol: str = '', exchange: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Commodity
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Commodity.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Commodity.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Commodity.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Commodity.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
ContFuture
ContFuture(symbol: str = '', exchange: str = '', localSymbol: str = '', multiplier: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.ContFuture
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.ContFuture.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.ContFuture.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.ContFuture.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.ContFuture.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Contract
Contract(secType: str = '', conId: int = 0, symbol: str = '', lastTradeDateOrContractMonth: str = '', strike: float = 0.0, right: str = '', multiplier: str = '', exchange: str = '', primaryExchange: str = '', currency: str = '', localSymbol: str = '', tradingClass: str = '', includeExpired: bool = False, secIdType: str = '', secId: str = '', description: str = '', issuerId: str = '', comboLegsDescrip: str = '', comboLegs: list['ComboLeg'] = <factory>, deltaNeutralContract: Optional[ForwardRef('DeltaNeutralContract')] = None) -> None
Completeness: fully-documented · Canonical ID: ib_async.contract.Contract
Explicit policy override after evidence-backed documentation review.
Related API navigation
- Protocol mapping:
Contract - Returned by:
IB.qualifyContracts - Returned by:
IB.qualifyContractsAsync
Sources and provenance
- ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z) - ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z) - ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z) - ibkr-campus-tws-api (
official-current; retrieved2026-07-14T19:13:54.602937Z)
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
create
create(**kwargs) -> 'Contract'
Completeness: signature-only · Canonical ID: ib_async.contract.Contract.create
Runtime signature is published; semantic enrichment remains outstanding.
Create and a return a specialized contract based on the given secType, or a general Contract if secType is not given.
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Contract.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
isHashable
isHashable(self) -> bool
Completeness: signature-only · Canonical ID: ib_async.contract.Contract.isHashable
Runtime signature is published; semantic enrichment remains outstanding.
See if this contract can be hashed by conId.
Note: Bag contracts always get conId=28812380, so they're not hashable by conId, but we generate a synthetic hash for them based on leg details instead.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Contract.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
recreate
recreate(c) -> 'Contract'
Completeness: signature-only · Canonical ID: ib_async.contract.Contract.recreate
Runtime signature is published; semantic enrichment remains outstanding.
Comply an existing generic Contract into its most specific type.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Contract.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Contract.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
ContractDescription
ContractDescription(contract: ib_async.contract.Contract | None = None, derivativeSecTypes: list[str] = <factory>) -> None
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDescription
Runtime signature is published; semantic enrichment remains outstanding.
Related API navigation
- Protocol mapping:
ContractDescription - Returned by:
IB.reqMatchingSymbols - Returned by:
IB.reqMatchingSymbolsAsync
Sources and provenance
- ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z) - ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z) - ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z)
ContractDescription(contract: ib_async.contract.Contract | None = None, derivativeSecTypes: list[str] = <factory>)
Fields
| Name | Type | Default |
|---|---|---|
contract | ib_async.contract.Contract | None | None |
derivativeSecTypes | list | factory: list |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDescription.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDescription.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDescription.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDescription.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
ContractDetails
ContractDetails(contract: ib_async.contract.Contract | None = None, marketName: str = '', minTick: float = 0.0, orderTypes: str = '', validExchanges: str = '', priceMagnifier: int = 0, underConId: int = 0, longName: str = '', contractMonth: str = '', industry: str = '', category: str = '', subcategory: str = '', timeZoneId: str = '', tradingHours: str = '', liquidHours: str = '', evRule: str = '', evMultiplier: int = 0, mdSizeMultiplier: int = 1, aggGroup: int = 0, underSymbol: str = '', underSecType: str = '', marketRuleIds: str = '', secIdList: list[ib_async.contract.TagValue] = <factory>, realExpirationDate: str = '', lastTradeTime: str = '', stockType: str = '', minSize: float = 0.0, sizeIncrement: float = 0.0, suggestedSizeIncrement: float = 0.0, cusip: str = '', ratings: str = '', descAppend: str = '', bondType: str = '', couponType: str = '', callable: bool = False, putable: bool = False, coupon: float = 0, convertible: bool = False, maturity: str = '', issueDate: str = '', nextOptionDate: str = '', nextOptionType: str = '', nextOptionPartial: bool = False, notes: str = '') -> None
Completeness: fully-documented · Canonical ID: ib_async.contract.ContractDetails
Explicit policy override after evidence-backed documentation review.
Related API navigation
- Protocol mapping:
ContractDetails - Returned by:
IB.reqContractDetails - Returned by:
IB.reqContractDetailsAsync
Sources and provenance
- ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z) - ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z) - ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z) - ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z)
ContractDetails(contract: ib_async.contract.Contract | None = None, marketName: str = '', minTick: float = 0.0, orderTypes: str = '', validExchanges: str = '', priceMagnifier: int = 0, underConId: int = 0, longName: str = '', contractMonth: str = '', industry: str = '', category: str = '', subcategory: str = '', timeZoneId: str = '', tradingHours: str = '', liquidHours: str = '', evRule: str = '', evMultiplier: int = 0, mdSizeMultiplier: int = 1, aggGroup: int = 0, underSymbol: str = '', underSecType: str = '', marketRuleIds: str = '', secIdList: list[ib_async.contract.TagValue] = <factory>, realExpirationDate: str = '', lastTradeTime: str = '', stockType: str = '', minSize: float = 0.0, sizeIncrement: float = 0.0, suggestedSizeIncrement: float = 0.0, cusip: str = '', ratings: str = '', descAppend: str = '', bondType: str = '', couponType: str = '', callable: bool = False, putable: bool = False, coupon: float = 0, convertible: bool = False, maturity: str = '', issueDate: str = '', nextOptionDate: str = '', nextOptionType: str = '', nextOptionPartial: bool = False, notes: str = '')
Fields
| Name | Type | Default |
|---|---|---|
contract | ib_async.contract.Contract | None | None |
marketName | str | `` |
minTick | float | 0.0 |
orderTypes | str | `` |
validExchanges | str | `` |
priceMagnifier | int | 0 |
underConId | int | 0 |
longName | str | `` |
contractMonth | str | `` |
industry | str | `` |
category | str | `` |
subcategory | str | `` |
timeZoneId | str | `` |
tradingHours | str | `` |
liquidHours | str | `` |
evRule | str | `` |
evMultiplier | int | 0 |
mdSizeMultiplier | int | 1 |
aggGroup | int | 0 |
underSymbol | str | `` |
underSecType | str | `` |
marketRuleIds | str | `` |
secIdList | list | factory: list |
realExpirationDate | str | `` |
lastTradeTime | str | `` |
stockType | str | `` |
minSize | float | 0.0 |
sizeIncrement | float | 0.0 |
suggestedSizeIncrement | float | 0.0 |
cusip | str | `` |
ratings | str | `` |
descAppend | str | `` |
bondType | str | `` |
couponType | str | `` |
callable | bool | False |
putable | bool | False |
coupon | float | 0 |
convertible | bool | False |
maturity | str | `` |
issueDate | str | `` |
nextOptionDate | str | `` |
nextOptionType | str | `` |
nextOptionPartial | bool | False |
notes | str | `` |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDetails.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
liquidSessions
liquidSessions(self) -> list[ib_async.contract.TradingSession]
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDetails.liquidSessions
Runtime signature is published; semantic enrichment remains outstanding.
No library docstring is provided; consult the signature, type fields, and operational guides.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDetails.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tradingSessions
tradingSessions(self) -> list[ib_async.contract.TradingSession]
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDetails.tradingSessions
Runtime signature is published; semantic enrichment remains outstanding.
No library docstring is provided; consult the signature, type fields, and operational guides.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDetails.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.ContractDetails.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Crypto
Crypto(symbol: str = '', exchange: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Crypto
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Crypto.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Crypto.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Crypto.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Crypto.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
DeltaNeutralContract
DeltaNeutralContract(conId: int = 0, delta: float = 0.0, price: float = 0.0) -> None
Completeness: signature-only · Canonical ID: ib_async.contract.DeltaNeutralContract
Runtime signature is published; semantic enrichment remains outstanding.
Related API navigation
- Protocol mapping:
DeltaNeutralContract
Sources and provenance
- ib-async-repository-2-1-0 (
library-source; retrieved2026-07-15T03:42:42Z)
DeltaNeutralContract(conId: int = 0, delta: float = 0.0, price: float = 0.0)
Fields
| Name | Type | Default |
|---|---|---|
conId | int | 0 |
delta | float | 0.0 |
price | float | 0.0 |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.DeltaNeutralContract.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.DeltaNeutralContract.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.DeltaNeutralContract.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.DeltaNeutralContract.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Forex
Forex(pair: str = '', exchange: str = 'IDEALPRO', symbol: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Forex
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Forex.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Forex.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
pair
pair(self) -> str
Completeness: signature-only · Canonical ID: ib_async.contract.Forex.pair
Runtime signature is published; semantic enrichment remains outstanding.
Short name of pair.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Forex.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Forex.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Future
Future(symbol: str = '', lastTradeDateOrContractMonth: str = '', exchange: str = '', localSymbol: str = '', multiplier: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Future
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Future.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Future.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Future.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Future.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
FuturesOption
FuturesOption(symbol: str = '', lastTradeDateOrContractMonth: str = '', strike: float = 0.0, right: str = '', exchange: str = '', multiplier: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.FuturesOption
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.FuturesOption.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.FuturesOption.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.FuturesOption.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.FuturesOption.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Index
Index(symbol: str = '', exchange: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Index
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Index.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Index.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Index.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Index.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
MutualFund
MutualFund(**kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.MutualFund
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.MutualFund.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.MutualFund.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.MutualFund.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.MutualFund.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Option
Option(symbol: str = '', lastTradeDateOrContractMonth: str = '', strike: float = 0.0, right: str = '', exchange: str = '', multiplier: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Option
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Option.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Option.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Option.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Option.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
ScanData
ScanData(rank: int, contractDetails: ib_async.contract.ContractDetails, distance: str, benchmark: str, projection: str, legsStr: str) -> None
Completeness: signature-only · Canonical ID: ib_async.contract.ScanData
Runtime signature is published; semantic enrichment remains outstanding.
ScanData(rank: int, contractDetails: ib_async.contract.ContractDetails, distance: str, benchmark: str, projection: str, legsStr: str)
Fields
| Name | Type | Default |
|---|---|---|
rank | int | required |
contractDetails | ContractDetails | required |
distance | str | required |
benchmark | str | required |
projection | str | required |
legsStr | str | required |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.ScanData.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.ScanData.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.ScanData.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.ScanData.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
Stock
Stock(symbol: str = '', exchange: str = '', currency: str = '', **kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Stock
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Stock.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Stock.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Stock.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Stock.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
TagValue
TagValue(tag: str, value: str)
Completeness: signature-only · Canonical ID: ib_async.contract.TagValue
Runtime signature is published; semantic enrichment remains outstanding.
TagValue(tag, value)
TradingSession
TradingSession(start: datetime.datetime, end: datetime.datetime)
Completeness: signature-only · Canonical ID: ib_async.contract.TradingSession
Runtime signature is published; semantic enrichment remains outstanding.
TradingSession(start, end)
Warrant
Warrant(**kwargs)
Completeness: signature-only · Canonical ID: ib_async.contract.Warrant
Runtime signature is published; semantic enrichment remains outstanding.
Contract(**kwargs) can create any contract using keyword
arguments. To simplify working with contracts, there are also more
specialized contracts that take optional positional arguments.
Some examples::
Contract(conId=270639) Stock('AMD', 'SMART', 'USD') Stock('INTC', 'SMART', 'USD', primaryExchange='NASDAQ') Forex('EURUSD') CFD('IBUS30') Future('ES', '20180921', 'GLOBEX') Option('SPY', '20170721', 240, 'C', 'SMART') Bond(secIdType='ISIN', secId='US03076KAA60') Crypto('BTC', 'PAXOS', 'USD')
Args: conId (int): The unique IB contract identifier. symbol (str): The contract (or its underlying) symbol. secType (str): The security type:
-
'STK' = Stock (or ETF)
-
'OPT' = Option
-
'FUT' = Future
-
'IND' = Index
-
'FOP' = Futures option
-
'CASH' = Forex pair
-
'CFD' = CFD
-
'BAG' = Combo
-
'WAR' = Warrant
-
'BOND' = Bond
-
'CMDTY' = Commodity
-
'NEWS' = News
-
'FUND' = Mutual fund
-
'CRYPTO' = Crypto currency
-
'EVENT' = Bet on an event lastTradeDateOrContractMonth (str): The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day. strike (float): The option's strike price. right (str): Put or Call. Valid values are 'P', 'PUT', 'C', 'CALL', or '' for non-options. multiplier (str): The instrument's multiplier (i.e. options, futures). exchange (str): The destination exchange. currency (str): The underlying's currency. localSymbol (str): The contract's symbol within its primary exchange. For options, this will be the OCC symbol. primaryExchange (str): The contract's primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT. For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE. tradingClass (str): The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL". includeExpired (bool): If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available. secIdType (str): Security identifier type. Examples for Apple:
- secIdType='ISIN', secId='US0378331005'
- secIdType='CUSIP', secId='037833100' secId (str): Security identifier. comboLegsDescription (str): Description of the combo legs. comboLegs (List[ComboLeg]): The legs of a combined contract definition. deltaNeutralContract (DeltaNeutralContract): Delta and underlying price for Delta-Neutral combo orders.
Fields
| Name | Type | Default |
|---|---|---|
secType | str | `` |
conId | int | 0 |
symbol | str | `` |
lastTradeDateOrContractMonth | str | `` |
strike | float | 0.0 |
right | str | `` |
multiplier | str | `` |
exchange | str | `` |
primaryExchange | str | `` |
currency | str | `` |
localSymbol | str | `` |
tradingClass | str | `` |
includeExpired | bool | False |
secIdType | str | `` |
secId | str | `` |
description | str | `` |
issuerId | str | `` |
comboLegsDescrip | str | `` |
comboLegs | list | factory: list |
deltaNeutralContract | Optional | None |
dict
dict(obj) -> dict
Completeness: signature-only · Canonical ID: ib_async.contract.Warrant.dict
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
Completeness: signature-only · Canonical ID: ib_async.contract.Warrant.nonDefaults
Runtime signature is published; semantic enrichment remains outstanding.
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Completeness: signature-only · Canonical ID: ib_async.contract.Warrant.tuple
Runtime signature is published; semantic enrichment remains outstanding.
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Completeness: signature-only · Canonical ID: ib_async.contract.Warrant.update
Runtime signature is published; semantic enrichment remains outstanding.
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.