{"id":15292977,"url":"https://github.com/matbarofex/rrofex","last_synced_at":"2025-05-07T03:11:31.283Z","repository":{"id":48317383,"uuid":"184498175","full_name":"matbarofex/rRofex","owner":"matbarofex","description":"R library to connect to Matba Rofex's Trading API. Functionality includes accessing account data and current holdings, retrieving investment quotes, placing and canceling orders, and getting reference data for instruments.","archived":false,"fork":false,"pushed_at":"2023-05-09T13:42:23.000Z","size":2411,"stargazers_count":25,"open_issues_count":0,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-07T03:11:24.707Z","etag":null,"topics":["api","finance","market-data","r","rlang","rofex","rofex-apis","trading-api"],"latest_commit_sha":null,"homepage":"https://matbarofex.github.io/rRofex","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matbarofex.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-02T00:12:04.000Z","updated_at":"2024-09-26T06:17:57.000Z","dependencies_parsed_at":"2024-10-23T14:01:01.587Z","dependency_job_id":null,"html_url":"https://github.com/matbarofex/rRofex","commit_stats":{"total_commits":104,"total_committers":6,"mean_commits":"17.333333333333332","dds":0.05769230769230771,"last_synced_commit":"1123815ac016229029ba5066de49fd1819ad4f31"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matbarofex%2FrRofex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matbarofex%2FrRofex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matbarofex%2FrRofex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matbarofex%2FrRofex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matbarofex","download_url":"https://codeload.github.com/matbarofex/rRofex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252804220,"owners_count":21806771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","finance","market-data","r","rlang","rofex","rofex-apis","trading-api"],"created_at":"2024-09-30T16:36:47.135Z","updated_at":"2025-05-07T03:11:31.269Z","avatar_url":"https://github.com/matbarofex.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/\",\n  out.width = \"100%\"\n)\noptions(tibble.print_min = 5, tibble.print_max = 5)\n```\n\n# rRofex \u003cimg src='man/figures/logo.png' align=\"right\" width=\"139px\"/\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![Travis build status](https://travis-ci.com/matbarofex/rRofex.svg?branch=master)](https://travis-ci.com/matbarofex/rRofex)\n[![CRAN status](https://www.r-pkg.org/badges/version/rRofex)](https://CRAN.R-project.org/package=rRofex)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/rRofex?color=orange)](https://cran.r-project.org/package=rRofex)\n\u003c!-- badges: end --\u003e\n\nWith this package, you will be able to execute API calls to the 'Matba Rofex' trading platform. \n\nThe main functionalites include:accessing account data and current holdings, retrieving investment quotes, placing and canceling orders, and getting reference data for instruments.\n\nYou can find the complete documentation under https://apihub.primary.com.ar/\n\n## Installation\n\n```{r, eval = FALSE}\n# To install the package you just need to use the command:\ninstall.packages(\"rRofex\")\n\n# Then load it with\nlibrary(rRofex)\n```\n\n#### Development version\n\nYou can use the development version to try new features or bug fixes directly from GitHub.\n\n```{r, eval=FALSE}\n# 1. In R install the package `devtools`.\ninstall.packages(\"devtools\")\n\n# 2. Once `devtools` is installed, install `rRofex`\nlibrary(devtools)\ndevtools::install_github(\"matbarofex/rRofex\")\n\n# 3. Then load it with\nlibrary(rRofex)\n```\n\n## References\n\nAt the present we provide two libraries for ingesting data from Matba Rofex:\n\n- **rRofex**: methods for trading. \n- [acyRsa](https://github.com/matbarofex/acyrsa): methods for accessing Back Office data from ACyRSA\n\n\n### Summary of actions for trading\n\nThese are the currently available actions within the library:\n\n- Authentication \n- Reference data request\n- Real-time and historical market data request\n- Orders placement\n- Orders management\n- Account information request\n- Websocket methods\n\n### Environments:\n\n- *Demo Environment*: go to [reMarkets](https://remarkets.primary.ventures/) to get free credentials. \n- *Production*: for credentials please contact: \u003cmpi@primary.com.ar\u003e for more information. \n- *Production - xOMS*: please contact your broker for credentials.\n\n### Connection Protocols\n\nThere are currently three standard protocols that are being used to connecting to the market::\n\n1. **REST**. Inside this library most methods use this protocol internaly. \n2. **Websocket**. The methods have the suffix 'ws' inside it's name.\n3. *FIX*. We don't have any short term plans to develop this wrapper.\n\n## Examples\n\n### 1. Authentication\n\nThere are different environment on which one can connect to. \n\nFor **paper trading** exists [reMarkets](https://remarkets.primary.ventures/). If you go there, you will be able to get free credentials to start trading with a demo account.\n\nIf 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*.\n\n```{r, eval=FALSE}\n# Using `trading_login()` you will be able to connect. \n# You will need to use this object in each request made. You can have multiple connections simultaneously.\nconn \u003c- trading_login(\n  username = XXX, \n  password = XXX, \n  base_url ='https://api.remarkets.primary.com.ar'\n  )\n\n# The connection is valid only for the day, you can get your log in information with `login_date_time()`\nlogin_date_time(conn)\n```\n\n### 2. Reference Data\n\nThere 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.\n\n```{r, eval=FALSE}\n# You can get a complete Reference Data list with details\ntrading_instruments(\n  connection = conn, \n  request = \"securities\", \n  sec_detailed = T\n  )\n\n# If you are interested only in the front month of each contract of features, you can try\ntrading_instruments_fronts(connection = conn)\n\n# If you only want equities\ntrading_instruments(\n  connection = conn, \n  request = \"by_type\", \n  sec_type = \"E\"\n  )\n```\n\n### 3. Market Data\n\nYou can access real time market data and historical market data. There is a version with Websocket being developed.\n\n```{r, eval=FALSE}\n# Real Time Prices using the REST protocol\ntrading_md(\n  connection = conn, \n  symbol = \"DODic20\"\n  )\n\n# Historical Trades\ntrading_mdh(\n  connection = conn, \n  symbol = \"DOJul20\", \n  date_from = \"2020-02-06\", \n  date_to = \"2020-03-06\"\n  )\n```\n\n### 4. Order Placement\n\nWith the method `trading_new_order()` you will be able to trade on the market. The basic order type is as follows:\n\n```{r, eval=FALSE}\ntrading_new_order(\n  connection = conn, \n  account = \"XXX\", \n  symbol = \"DOEne21\", \n  side = \"Buy\", \n  quantity = 10, \n  price = 92.14\n  )\n```\n\n### 5. Order Management\n\nIf you want to know the status of your arder, you will need ths method:\n\n```{r, eval=FALSE}\ntrading_orders(\n  connection = conn, \n  account = \"XXX\"\n  )\n```\n\n### 6. Account Information\n\nWith `trading_account()` and `trading_account_report()` you will be able to obtain information about your current position in terms of instruments and in terms of cash and settlement dates.\n\n```{r, eval=FALSE}\n# With trading account you can get the information about your basket\ntrading_account(\n  connection = conn, \n  account = \"XXX\"\n  )\n\n# With trading account report you can have your cash, margins, etc.\ntrading_account_report(\n  connection = conn, \n  account = \"XXX\"\n  )\n```\n### 7. Websocket Methods\n\nInstead 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.\n\nThe methods available in Websocket protool are:\n\n- Listen to Market Data with `trading_ws_md()`\n- Listen to Order status with `trading_ws_orders()`\n- Close Websocket connections with `trading_ws_close()`\n\n\n## Acknowledgments\n\nDevelopment of this software was driven by [Primary](https://www.primary.com.ar/) as part of an Open Source initiative of [Matba Rofex](https://matbarofex.com.ar/).\n\n#### Author/Maintainer\n- [Augusto Hassel](https://github.com/augustohassel)\n\n#### Internal Contributors\n- [Juan Francisco Gomez](https://github.com/jfgomezok)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatbarofex%2Frrofex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatbarofex%2Frrofex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatbarofex%2Frrofex/lists"}