Learn R Programming

bitmexr - R Client for the bitmex exchange

Overview

The goal of bitmexr is to provide an API wrapper for cryptocurrency derivatives exchange, BitMEX. bitmexr now provides support for all API endpoints for both the Testnet (www.testnet.bitmex.com) and the live exchange (www.bitmex.com). For more information about the API, check https://www.bitmex.com/app/apiOverview.

Installation

The development version of bitmexr can be installed from github:

# install.packages("devtools")
devtools::install_github("hfshr/bitmexr")

Or the released version from CRAN:

install.packages("bitmexr")

Package contents

The package contains dedicated wrappers for the majority of API endpoints.

  • trades() and map_trades() return individual trade data for a specified symbol/time period.
  • bucket_trades() and map_bucket_trades() return bucketed trade data (open, high, low, close) for either 1-minute, 5-minute, 1-hour or 1-day time frames for a specified symbol.
  • place_order(), edit_order() and cancel_order() can be used to manage trades on the exchange.

Additional API endpoints that do not have a dedicated wrapper can be accessed using get_bitmex() for GET requests and post_bitmex() for POST requests. For example use:

get_bitmex(path = "/chat", args = list(reverse = "false"))

to get the latest trollbox messages.

Testnet API

All functions in the package also work with BitMEX’s Testnet API. Simply use the “tn_” prefix to access the Testnet version of the function. For example tn_place_order() will place an order on the Testnet exchange.

Authentication

Accessing private API endpoints, such as those to manage trades, requires an API key and secret. bitmexr reads these from your ~/.Renviron file - see vignette Authentication for more information.

Disclaimer

This software is in no way affiliated, endorsed, or approved by the BitMEX cryptocurrency exchange or any of its affiliates.

Contribution

If you spot any issues, or would like additional features added, please feel free to raise an issue, or submit a pull request.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Copy Link

Version

Install

install.packages('bitmexr')

Monthly Downloads

257

Version

0.3.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Harry Fisher

Last Published

August 7th, 2023

Functions in bitmexr (0.3.3)

tn_map_bucket_trades

Bucket trade data over an extended period (testnet)
post_bitmex

POST requests
tn_cancel_all_orders

Cancel all orders (testnet)
tn_map_trades

Trade data over an extended period (testnet)
tn_cancel_order

Cancel order (testnet)
tn_edit_order

Edit an order (testnet)
tn_bucket_trades

Bucketed trade data (testnet)
tn_place_order

Place an order (testnet)
tn_post_bitmex

POST requests (testnet)
tn_get_bitmex

GET requests (testnet)
valid_dates

Start date of data availability for available symbols
trades

Individual trade data
tn_trades

Individual trade data (testnet)
bucket_trades

Bucketed trade data
edit_order

Edit an order
place_order

Place an order
map_bucket_trades

Bucket trade data over an extended period
get_bitmex

GET requests
available_symbols

Available symbols
cancel_all_orders

Cancel all orders
bitmexr

bitmexr: R Client for the BitMEX Exchange
cancel_order

Cancel order
map_trades

Trade data over an extended period