twsOption {IBrokers} | R Documentation |
Create a twsContract for use in API calls.
twsOption(local, expiry="", strike="", right="", exch="SMART", primary="", currency='USD', symbol='', include_expired='0')
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] |
include_expired |
should expired contracts be included [defaults to “0” (false)] |
A wrapper to twsContract
to make ‘option’
contracts easier to specify.
A twsContract
object.
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 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 one of 30 secs, 1 min, 5 mins, 15 mins, 30 mins,
or 1 hour.
Jeffrey A. Ryan
Interactive Brokers: www.interactivebrokers.com
opt <- twsOption("QQQAS",expiry="200901", strike="45.0", right="C")