With this package, you will be able to execute API calls to the ‘Matba Rofex’ trading platform.
The main functionalites include:accessing account data and current holdings, retrieving investment quotes, placing and canceling orders, and getting reference data for instruments.
You can find the complete documentation under https://apihub.primary.com.ar/
# To install the package you just need to use the command: install.packages("rRofex") # Then load it with library(rRofex)
You can use the development version to try new features or bug fixes directly from GitHub.
At the present we provide two libraries for ingesting data from Matba Rofex:
These are the currently available actions within the library:
There are currently three standard protocols that are being used to connecting to the market::
There are different environment on which one can connect to.
For paper trading exists reMarkets. If you go there, you will be able to get free credentials to start trading with a demo account.
If you already have a live trading account with a broker, you should ask them what kind of order management system (OMS) do they use. If they have the suite of Primary, then you will have to ask them for the user, password and base_url.
# Using `trading_login()` you will be able to connect. # You will need to use this object in each request made. You can have multiple connections simultaneously. conn <- trading_login( username = XXX, password = XXX, base_url ='https://api.remarkets.primary.com.ar' ) # The connection is valid only for the day, you can get your log in information with `login_date_time()` login_date_time(conn)
There are many types of request that you can make in order to get reference data. The basic one is to ask for a detailed list of every listed instrument.
# You can get a complete Reference Data list with details trading_instruments( connection = conn, request = "securities", sec_detailed = T ) # If you are interested only in the front month of each contract of features, you can try trading_instruments_fronts(connection = conn) # If you only want equities trading_instruments( connection = conn, request = "by_type", sec_type = "E" )
You can access real time market data and historical market data. There is a version with Websocket being developed.
With the method
trading_new_order() you will be able to trade on the market. The basic order type is as follows:
trading_new_order( connection = conn, account = "XXX", symbol = "DOEne21", side = "Buy", quantity = 10, price = 92.14 )
If you want to know the status of your arder, you will need ths method:
trading_orders( connection = conn, account = "XXX" )
Instead of requesting information using REST protocol, you could get it through Websocket. This means, that you can listen to an object and be notified every time that a change has been made.
The methods available in Websocket protool are: