IBrokers-package {IBrokers} | R Documentation |
R API to the Interactive Brokers Trader Workstation (TWS).
Description
This software is in no way affiliated, endorsed, or approved by Interactive Brokers or any of its affiliates. It comes with absolutely no warranty and should not be used in actual trading unless the user can read and understand the source.
IBrokers is a pure R implementation of the TWS API. At present it is only able pull data from the Interactive Brokers servers via the TWS. Future additions will include more API access, including live order handling, and better management across R sessions.
Possible real-time charting via the quantmod package may be incorporated into future releases.
Changes to move to version 0.1-0 have made this API implementation much more robust on all platforms. Many new error-checking calls have been incorporated, as well as a more reliable event-loop to capture the data from the TWS.
The underlying socket connections are pure R. This was a design decision to maximize cross-platform availability, as well as a recognition that historical data requests, or any requests while in a single threaded R session, must be non-threaded.
Recent additions include reqMktData
to
handle live market data from one or more
symbols, reqMktDepth
to
capture market depth for one or more
symbols, and
reqRealTimeBars
to recieve 5 second
real time bars. Each of these functions
have been implemented with optional user
defined callback handlers
to allow for R code to interact with the API
while receiving data from the TWS.
Please report any and all bugs/experiences to the maintainer so they can be corrected or incorporated into future versions.
Additionally, beta testers are needed to make this a viable alternative for IB-API interaction. Don't be shy.
Details
Package: | IBrokers |
Type: | Package |
Version: | 0.9-7 |
Date: | 2012-04-27 |
License: | GPL-3 |
The current API methods supported are:
twsConnect
: Establish TWS connection
twsDisconnect
: Close TWS connection
isConnected
: Check connection
setServerLogLevel
: Set logging level
twsAccountUpdates
: Get Account Details
reqIds
: Request next available ID
reqCurrentTime
: The TWS server time in seconds since the epoch
reqHistoricalData
: Fetch historical data
reqMktData
: Receive real-time market data
reqMktDepth
: Receive real-time order book depth
reqRealTimeBars
: Receive 5 second OHLCVWC bar data
Experimental support:
placeOrder
: Place a live order to the TWS
cancelOrder
: Cancel a pending order on the TWS
Author(s)
Jeffrey A. Ryan
Maintainer: Joshua M. Ulrich <josh.m.ulrich@gmail.com>
References
Interactive Brokers: https://www.interactivebrokers.com
Examples
## Not run:
IBrokersRef() # IBrokers Reference Card in PDF viewer
tws <- twsConnect() # make a new connection to the TWS
reqCurrentTime(tws) # check the server's timestamp
contract <- twsEquity('IBKR','SMART','ISLAND') # equity specification
reqHistoricalData(tws,contract) # request historical data
twsDisconnect(tws) # disconnect from the TWS
## End(Not run)