Connect R to the world's markets.
website](https://www.r-project.org/). The R language is maintained by the Comprehensive R Archive Network, made up of many copies ("mirrors") of the main website containing all of the instructions and files for downloading R. Each of these mirrors is hosted by volunteers. You can choose the mirror whose geographic location is nearest to you to minimize download time and network load, but really it doesn't make much difference which mirror you pick. - Windows Users should also install Rtools. - If you're a Mac User, also install Xcode. Go get a coffee, it'll take a few minutes.
Follow the instructions on Git's webpage for your particular OS.
You may also choose to install IBGateway (IBG). IB Gateway will not work with the free demo provided by Interactive Brokers, but for paper and trading accounts it provides all of the functionality of Trader Workstation without the charting and graphical user interface.
This can be done for free, and you do not have to fund the account with real money. The advantage of creating an account is that doing so allows you to create a paper trading account that you may use to develop and test any trading system you develop.
While you are free to use InteractiveTradeR
on your paper account, note that
using InteractiveTradeR
to place trades on an actual trading account is a
violation of the license, which does not allow for commercial use. To obtain a
commercial license, please contact the author.
RStudio](https://rstudio.com/products/rstudio/download/#download).
devtools
with:install.packages("devtools")
InteractiveTradeR
package with:devtools::install_github("JakeVestal/InteractiveTradeR")
To create new, use File > New Project > New Directory > New Project. Name the new project anything you want.
InteractiveTradeR
with:library("InteractiveTradeR")
If this is the first time you've loaded InteractiveTradeR
in the current
RStudio project, you'll be asked if you want to establish some default settings.
Do so. This action will store default connection parameters (port number, host,
master client ID) as R variables so that you don't have to re-enter them. You
may change these parameters at any later time.
Open whichever program you installed and wish to use -- TWS or IBG -- and log in to your account, paper account, or the demo (TWS only).
From the File menu, find File > Global Configuration > API > Settings.
Check the "Enable ActiveX and Socket Clients" box.
Uncheck the "Read-Only API" box if you wish to allow InteractiveTradeR
to
write to the API, for example, to place orders.
In RStudio, retreive your randomly generated Master Client ID by entering
command active_connection_parameters()
. Copy-paste this numeric ID into the
"MASTER CLIENT ID" field in the API Settings window.
Click "Apply and OK" to close the API Settings window.
At this point, you should have an instance of TWS or IBG running and accepting
connections from the API. Within RStudio, with InteractiveTradeR
having been
loaded, you can test your connection with command req_current_time()
. If you
get a timestamp response, all's well and you're set up!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.