twsOption {IBrokers} | R Documentation |
Create a twsContract for Options
Description
Create a twsContract for use in API calls.
Usage
twsOption(local,
expiry="",
strike="",
right="",
exch="SMART",
primary="",
currency='USD',
symbol='',
multiplier="100",
include_expired='0',
conId=0)
Arguments
local |
the IB symbol requested |
expiry |
option expiration CCYYMM [optional] |
strike |
the strike price [optional] |
right |
the requested right - ‘C’,‘CALL’, ‘P’, or ‘PUT’ [optional] |
exch |
the requested exchange [optional, defaults to SMART] |
primary |
the primary exchange of the security [optional] |
currency |
the requested currency [defaults to USD] |
symbol |
the security name [optional] |
multiplier |
the contract multiplier |
include_expired |
should expired contracts be included [defaults to “0” (false)] |
conId |
contract ID |
Details
A wrapper to twsContract
to make ‘option’
contracts easier to specify.
Some of the optionable parameters are contingent on the request being made. Refer to the TWS documentation for details.
twsOPT
is an alias.
Value
A twsContract
object.
Note
Option contracts on the TWS have certain rules which are different than standard data requests.
The local
symbol is required. This can be found on the main TWS
screen under contract details, or via the web at https://www.interactivebrokers.com
Since the local symbol is required, all other values are redundant. It is best to simply specify the local name and let the TWS manage the lookup.
The expiry
needs to be either of class Date
to be coerced to
a string of format ‘CCYYMM’, or provided in that format.
Historical requests cannot be for a barSize=‘1 D’ or less frequent.
barSize
must be "1 min" per Interactive Brokers API.
Author(s)
Jeffrey A. Ryan
References
Interactive Brokers: https://www.interactivebrokers.com
See Also
Examples
opt <- twsOption("QQQAS",expiry="200901", strike="45.0", right="C")