Method | Description | |
---|---|---|
CalculateImpliedVolatility ( int reqId, Contract contract, double optionPrice, double underPrice, List |
Calculate the volatility for an option. Request the calculation of the implied volatility based on hypothetical option and its underlying prices. The calculation will be return in TickOptionComputationAsync callback.
|
|
CalculateOptionPrice ( int reqId, Contract contract, double volatility, double underPrice, List |
Calculates an option's price. Calculates an option's price based on the provided volatility and its underlying's price. The calculation will be return in TickOptionComputationAsync callback.
|
|
CancelAccountSummary ( int reqId ) : void |
Cancels the account's summary request. After requesting an account's summary, invoke this function to cancel it.
|
|
CancelCalculateImpliedVolatility ( int reqId ) : void |
Cancels an option's implied volatility calculation request.
|
|
CancelCalculateOptionPrice ( int reqId ) : void |
Cancels an option's price calculation request.
|
|
CancelFundamentalData ( int reqId ) : void |
Cancels Fundamental data request.
|
|
CancelHistoricalData ( int reqId ) : void |
Cancels a historical data request.
|
|
CancelMktData ( int tickerId ) : void |
Cancels a RT Market Data request.
|
|
CancelMktDepth ( int tickerId ) : void |
Cancel's market depth's request.
|
|
CancelNewsBulletin ( ) : void |
Cancels IB's news bulletin subscription.
|
|
CancelOrder ( int orderId ) : void |
Cancels an active order.
|
|
CancelPositions ( ) : void |
Cancels all account's positions request.
|
|
CancelRealTimeBars ( int tickerId ) : void |
Cancels Real Time Bars' subscription.
|
|
CancelScannerSubscription ( int tickerId ) : void |
Cancels Scanner Subscription.
|
|
ExerciseOptions ( int tickerId, Contract contract, int exerciseAction, int exerciseQuantity, string account, int ovrd ) : void |
Exercises your options.
|
|
IbClientRequestHandler ( IIbClientConnection ibClientConnection ) : System | ||
PlaceOrder ( int id, Contract contract, IBApi.Order order ) : void |
Places an order.
|
|
QueryDisplayGroups ( int requestId ) : void | ||
ReplaceFA ( int faDataType, string xml ) : void |
Replaces Financial Advisor's settings. A Financial Advisor can define three different configurations: 1. Groups: offer traders a way to create a group of accounts and apply a single allocation method to all accounts in the group. 2. Profiles: let you allocate shares on an account-by-account basis using a predefined calculation value. 3. Account Aliases: let you easily identify the accounts by meaningful names rather than account numbers. More information at https://www.interactivebrokers.com/en/?f=%2Fen%2Fsoftware%2Fpdfhighlights%2FPDF-AdvisorAllocations.php%3Fib_entity%3Dllc WARNING: IB has not tested this yet! |
|
ReqAccountSummary ( int reqId, string group, string tags ) : void |
Requests a specific account's summary.This method will subscribe to the account summary as presented in the TWS' Account Summary tab.
|
|
ReqAccountUpdates ( bool subscribe, string acctCode ) : void |
Subscribes to an specific account's information and portfolio. Through this method, a single account's subscription can be started/stopped. As a result from the subscription, the account's information, portfolio and last update time will be received at UpdateAccountValueAsync, UpdateAccountPortfolioAsync, UpdateAccountTimeAsync respectively. Only one account can be subscribed at a time. A second subscription request for another account when the previous one is still active will cause the first one to be canceled in favour of the second one. Consider user ReqPositions if you want to retrieve all your accounts' portfolios directly.
|
|
ReqAllOpenOrders ( ) : void |
Requests all open orders submitted by any API client as well as those directly placed in the TWS. The existing orders will be received via the openOrder and orderStatus events.
|
|
ReqAutoOpenOrders ( bool autoBind ) : void |
Requests all order placed on the TWS directly. Only the orders created after this request has been made will be returned.
|
|
ReqContractDetails ( int reqId, Contract contract ) : void |
Requests contract information. This method will provide all the contracts matching the contract provided. It can also be used to retrieve complete options and futures chains. This information will be returned at ContractDetails.
|
|
ReqCurrentTime ( ) : void |
Requests the server's current time.
|
|
ReqExecutions ( int reqId, IBApi.ExecutionFilter filter ) : void |
Requests all the day's executions matching the filter. Only the current day's executions can be retrieved. Along with the executions, the CommissionReport will also be returned. The execution details will arrive at ExecDetailsAsync.
|
|
ReqFundamentalData ( int reqId, Contract contract, String reportType, List |
Requests the contract's Reuters' global fundamental data. Reuters funalmental data will be returned at FundamentalDataAsync.
|
|
ReqGlobalCancel ( ) : void |
Cancels all the active orders. This method will cancel ALL open orders included those placed directly via the TWS.
|
|
ReqHistoricalData ( int tickerId, Contract contract, string endDateTime, string durationString, string barSizeSetting, string whatToShow, int useRTH, int formatDate, List |
Requests contracts' historical data. When requesting historical data, a finishing time and date is required along with a duration string. For example, having endDateTime = 20130701 23:59:59 GMT and durationStr = 3 D will return three days of data counting backwards from July 1st 2013 at 23:59:59 GMT resulting in all the available bars of the last three days until the date and time specified. It is possible to specify a timezone optionally. The resulting bars will be returned in HistoricalDataAsync.
|
|
ReqIds ( int numIds ) : void |
Requests the next valid order id.
|
|
ReqManagedAccts ( ) : void |
Requests the accounts to which the logged user has access to.
|
|
ReqMarketDataType ( int marketDataType ) : void |
Indicates the TWS to switch to "frozen" market data. The API can receive frozen market data from Trader Workstation. Frozen market data is the last data recorded in our system. During normal trading hours, the API receives real-time market data. If you use this function, you are telling TWS to automatically switch to frozen market data after the close. Then, before the opening of the next trading day, market data will automatically switch back to real-time market data.
|
|
ReqMktData ( int tickerId, Contract contract, string genericTickList, bool snapshot, List |
Requests real time market data. This function will return the product's market data. It is important to notice that only real time data can be delivered via the API.
|
|
ReqMktDepth ( int tickerId, Contract contract, int numRows, List |
Requests the contract's market depth (order book).
|
|
ReqNewsBulletins ( bool allMessages ) : void |
Subscribes to IB's News Bulletins.
|
|
ReqOpenOrders ( ) : void |
Requests all open orders places by this specific API client (identified by the API client id).
|
|
ReqPositions ( ) : void |
Requests all positions from all accounts.
|
|
ReqRealTimeBars ( int tickerId, Contract contract, int barSize, string whatToShow, bool useRTH, List |
Requests real time bars. Currently, only 5 seconds bars are provided. This request ius suject to the same pacing as any historical data request: no more than 60 API queries in more than 600 seconds.
|
|
ReqScannerParameters ( ) : void |
Requests all possible parameters which can be used for a scanner subscription.
|
|
ReqScannerSubscription ( int reqId, IBApi.ScannerSubscription subscription, List |
Starts a subscription to market scan results based on the provided parameters.
|
|
RequestFA ( int faDataType ) : void |
Requests the FA configuration. A Financial Advisor can define three different configurations: 1. Groups: offer traders a way to create a group of accounts and apply a single allocation method to all accounts in the group. 2. Profiles: let you allocate shares on an account-by-account basis using a predefined calculation value. 3. Account Aliases: let you easily identify the accounts by meaningful names rather than account numbers. More information at https://www.interactivebrokers.com/en/?f=%2Fen%2Fsoftware%2Fpdfhighlights%2FPDF-AdvisorAllocations.php%3Fib_entity%3Dllc
|
|
SetServerLogLevel ( int logLevel ) : void |
Changes the TWS/GW log level.
|
|
SubscribeToGroupEvents ( int requestId, int groupId ) : void | ||
UnsubscribeFromGroupEvents ( int requestId ) : void | ||
UpdateDisplayGroup ( int requestId, string contractInfo ) : void |
Method | Description | |
---|---|---|
CheckConnection ( ) : void | ||
CheckServerVersion ( int requestId, int requiredVersion ) : void | ||
CheckServerVersion ( int tickerId, int requiredVersion, string updateTail ) : void | ||
CheckServerVersion ( int requiredVersion, string updatetail ) : void | ||
StringsAreEqual ( string a, string b ) : bool | ||
TagValueListToString ( List |
||
VerifyOrder ( IBApi.Order order, int id, bool isBagOrder ) : bool | ||
VerifyOrderContract ( Contract contract, int id ) : bool |
public CalculateImpliedVolatility ( int reqId, Contract contract, double optionPrice, double underPrice, List |
||
reqId | int | Unique identifier of the request. |
contract | Contract | The option's contract for which the volatility wants to be calculated. |
optionPrice | double | Hypothetical option price. |
underPrice | double | Hypothetical option's underlying price. |
impliedVolatilityOptions | List |
|
return | void |
public CalculateOptionPrice ( int reqId, Contract contract, double volatility, double underPrice, List |
||
reqId | int | Request's unique identifier. |
contract | Contract | The option's contract for which the price wants to be calculated. |
volatility | double | Hypothetical volatility. |
underPrice | double | Hypothetical underlying's price. |
optionPriceOptions | List |
|
return | void |
public CancelAccountSummary ( int reqId ) : void | ||
reqId | int | The identifier of the previously performed account request. |
return | void |
public CancelCalculateImpliedVolatility ( int reqId ) : void | ||
reqId | int | The identifier of the implied volatility's calculation request. |
return | void |
public CancelCalculateOptionPrice ( int reqId ) : void | ||
reqId | int | The identifier of the option's price's calculation request. |
return | void |
public CancelFundamentalData ( int reqId ) : void | ||
reqId | int | The request's idenfier. |
return | void |
public CancelHistoricalData ( int reqId ) : void | ||
reqId | int | The request's identifier. |
return | void |
public CancelMktData ( int tickerId ) : void | ||
tickerId | int | Request's identifier. |
return | void |
public CancelMktDepth ( int tickerId ) : void | ||
tickerId | int | Request's identifier. |
return | void |
public CancelOrder ( int orderId ) : void | ||
orderId | int | The order's client id |
return | void |
public CancelRealTimeBars ( int tickerId ) : void | ||
tickerId | int | The request's identifier. |
return | void |
public CancelScannerSubscription ( int tickerId ) : void | ||
tickerId | int | The subscription's unique identifier. |
return | void |
public ExerciseOptions ( int tickerId, Contract contract, int exerciseAction, int exerciseQuantity, string account, int ovrd ) : void | ||
tickerId | int | Exercise request's identifier. |
contract | Contract | The option Contract to be exercised. |
exerciseAction | int | Set to 1 to exercise the option, set to 2 to let the option lapse. |
exerciseQuantity | int | Number of contracts to be exercised. |
account | string | Destination account. |
ovrd | int | Specifies whether your setting will override the system's natural action. For example, if your action is "exercise" and the option is not in-the-money, by natural action the option would not exercise. If you have override set to "yes" the natural action would be overridden and the out-of-the money option would be exercised. Set to 1 to override, set to 0 not to. |
return | void |
public IbClientRequestHandler ( IIbClientConnection ibClientConnection ) : System | ||
ibClientConnection | IIbClientConnection | |
return | System |
public PlaceOrder ( int id, Contract contract, IBApi.Order order ) : void | ||
id | int | The order's unique identifier. Use a sequential id starting with the id received at the nextValidId method. |
contract | Contract | The order's contract. |
order | IBApi.Order | The order. |
return | void |
public QueryDisplayGroups ( int requestId ) : void | ||
requestId | int | |
return | void |
public ReplaceFA ( int faDataType, string xml ) : void | ||
faDataType | int | The configuration to change. Set to 1, 2 or 3 as defined above. |
xml | string | The xml-formatted configuration string |
return | void |
public ReqAccountSummary ( int reqId, string group, string tags ) : void | ||
reqId | int | The unique request identifier. |
group | string | Set to "All" to return account summary data for all accounts, or set to a specific Advisor Account Group name that has already been created in TWS Global Configuration. |
tags | string | /// A comma separated list with the desired tags: /// - AccountType /// - NetLiquidation, /// - TotalCashValue — Total cash including futures pnl /// - SettledCash — For cash accounts, this is the same as TotalCashValue /// - AccruedCash — Net accrued interest /// - BuyingPower — The maximum amount of marginable US stocks the account can buy /// - EquityWithLoanValue — Cash + stocks + bonds + mutual funds /// - PreviousEquityWithLoanValue, /// - GrossPositionValue — The sum of the absolute value of all stock and equity option positions /// - RegTEquity, /// - RegTMargin, /// - SMA — Special Memorandum Account /// - InitMarginReq, /// - MaintMarginReq, /// - AvailableFunds, /// - ExcessLiquidity, /// - Cushion — Excess liquidity as a percentage of net liquidation value /// - FullInitMarginReq, /// - FullMaintMarginReq, /// - FullAvailableFunds, /// - FullExcessLiquidity, /// - LookAheadNextChange — Time when look-ahead values take effect /// - LookAheadInitMarginReq, /// - LookAheadMaintMarginReq, /// - LookAheadAvailableFunds, /// - LookAheadExcessLiquidity, /// - HighestSeverity — A measure of how close the account is to liquidation /// - DayTradesRemaining — The Number of Open/Close trades a user could put on before Pattern Day Trading is detected. A value of "-1" means that the user can put on unlimited day trades. /// - Leverage — GrossPositionValue / NetLiquidation /// |
return | void |
public ReqAccountUpdates ( bool subscribe, string acctCode ) : void | ||
subscribe | bool | Set to true to start the subscription and to false to stop it. |
acctCode | string | The account id (i.e. U123456) for which the information is requested. |
return | void |
public ReqAutoOpenOrders ( bool autoBind ) : void | ||
autoBind | bool | If set to true, the newly created orders will be implicitely associated with this client. |
return | void |
public ReqContractDetails ( int reqId, Contract contract ) : void | ||
reqId | int | The unique request identifier. |
contract | Contract | The contract used as sample to query the available contracts. Typically, it will contain the Contract::Symbol, Contract::Currency, Contract::SecType, Contract::Exchange |
return | void |
public ReqExecutions ( int reqId, IBApi.ExecutionFilter filter ) : void | ||
reqId | int | The request's unique identifier. |
filter | IBApi.ExecutionFilter | The filter criteria used to determine which execution reports are returned. |
return | void |
public ReqFundamentalData ( int reqId, Contract contract, String reportType, List |
||
reqId | int | The request's unique identifier. |
contract | Contract | The contract's description for which the data will be returned. |
reportType | String | /// There are three available report types: /// - ReportSnapshot: Company overview /// - ReportsFinSummary: Financial summary /// - ReportRatios: Financial ratios /// - ReportsFinStatements: Financial statements /// - RESC: Analyst estimates /// - CalendarReport: Company calendar /// |
fundamentalDataOptions | List |
|
return | void |
public ReqHistoricalData ( int tickerId, Contract contract, string endDateTime, string durationString, string barSizeSetting, string whatToShow, int useRTH, int formatDate, List |
||
tickerId | int | The request's unique identifier. |
contract | Contract | The contract for which we want to retrieve the data. |
endDateTime | string | Request's ending time with format yyyyMMdd HH:mm:ss {TMZ}. |
durationString | string | /// The amount of time for which the data needs to be retrieved: /// - " S (seconds) /// - " D (days) /// - " W (weeks) /// - " M (months) /// - " Y (years) /// |
barSizeSetting | string | /// The size of the bar: /// - 1 sec /// - 5 secs /// - 15 secs /// - 30 secs /// - 1 min /// - 2 mins /// - 3 mins /// - 5 mins /// - 15 mins /// - 30 mins /// - 1 hour /// - 1 day /// |
whatToShow | string | /// The kind of information being retrieved: /// - TRADES /// - MIDPOINT /// - BID /// - ASK /// - BID_ASK /// - HISTORICAL_VOLATILITY /// - OPTION_IMPLIED_VOLATILITY /// |
useRTH | int | Set to 0 to obtain the data which was also generated ourside of the Regular Trading Hours, set to 1 to obtain only the RTH data. |
formatDate | int | Set to 1 to obtain the bars' time as yyyyMMdd HH:mm:ss, set to 2 to obtain it like system time format in seconds. |
chartOptions | List |
|
return | void |
public ReqMarketDataType ( int marketDataType ) : void | ||
marketDataType | int | Set to 1 for real time streaming, set to 2 for frozen market data. |
return | void |
public ReqMktData ( int tickerId, Contract contract, string genericTickList, bool snapshot, List |
||
tickerId | int | The request's identifier. |
contract | Contract | /// The Contract for which the data is being requested: /// - 100 Option Volume (currently for stocks) /// - 101 Option Open Interest (currently for stocks) /// - 104 Historical Volatility (currently for stocks) /// - 106 Option Implied Volatility (currently for stocks) /// - 162 Index Future Premium /// - 165 Miscellaneous Stats /// - 221 Mark Price (used in TWS P&L computations) /// - 225 Auction values (volume, price and imbalance) /// - 233 RTVolume - contains the last trade price, last trade size, last trade time, total volume, VWAP, and single trade flag. /// - 236 Shortable /// - 256 Inventory /// - 258 Fundamental Ratios /// - 411 Realtime Historical Volatility /// - 456 IBDividends /// |
genericTickList | string | Comma separated ids of the available generic ticks. |
snapshot | bool | When set to true, it will provide a single snapshot of the available data. Set to false if you want to receive continuous updates. |
mktDataOptions | List |
|
return | void |
public ReqMktDepth ( int tickerId, Contract contract, int numRows, List |
||
tickerId | int | The request's identifier. |
contract | Contract | The Contract for which the depth is being requested. |
numRows | int | The number of rows on each side of the order book. |
mktDepthOptions | List |
|
return | void |
public ReqNewsBulletins ( bool allMessages ) : void | ||
allMessages | bool | If set to true, will return all the existing bulletins for the current day, set to false to receive only the new bulletins. |
return | void |
public ReqRealTimeBars ( int tickerId, Contract contract, int barSize, string whatToShow, bool useRTH, List |
||
tickerId | int | The request's unique identifier. |
contract | Contract | The Contract for which the depth is being requested. |
barSize | int | Currently being ignored. |
whatToShow | string | /// The nature of the data being retrieved: /// - TRADES /// - MIDPOINT /// - BID /// - ASK /// |
useRTH | bool | Set to 0 to obtain the data which was also generated ourside of the Regular Trading Hours, set to 1 to obtain only the RTH data. |
realTimeBarsOptions | List |
|
return | void |
public ReqScannerSubscription ( int reqId, IBApi.ScannerSubscription subscription, List |
||
reqId | int | The request's identifier. |
subscription | IBApi.ScannerSubscription | Summary of the scanner subscription including its filters. |
scannerSubscriptionOptions | List |
|
return | void |
public RequestFA ( int faDataType ) : void | ||
faDataType | int | The configuration to change. Set to 1, 2 or 3 as defined above. |
return | void |
public SetServerLogLevel ( int logLevel ) : void | ||
logLevel | int | /// Valid values are: /// 1 = SYSTEM /// 2 = ERROR /// 3 = WARNING /// 4 = INFORMATION /// 5 = DETAIL /// |
return | void |
public SubscribeToGroupEvents ( int requestId, int groupId ) : void | ||
requestId | int | |
groupId | int | |
return | void |
public UnsubscribeFromGroupEvents ( int requestId ) : void | ||
requestId | int | |
return | void |
public UpdateDisplayGroup ( int requestId, string contractInfo ) : void | ||
requestId | int | |
contractInfo | string | |
return | void |