Skip to content

Latest commit

 

History

History
85 lines (64 loc) · 3.13 KB

README.md

File metadata and controls

85 lines (64 loc) · 3.13 KB

manifoldr

Lifecycle: experimental Codecov test coverage

The goal of manifoldr is to streamline interactions between R users and the Manifold Markets API. The Manifold Markets API documentation can be found here. All endpoints are supported as of November 2022.

Installation

You can install the development version of manifoldr from GitHub with:

# install.packages("devtools")
devtools::install_github("jcblsn/manifoldr")

Authentication

Some endpoints require authentication. The following instructions are provided in the API documentation:

Each account may have zero or one API keys. To generate an API key for your account, visit your user profile, click “edit”, and click the “refresh” button next to the API key field at the bottom. You can click it again any time to invalidate your existing key and generate a new one.

Suggested use for this package is to add an API key associated with a Manifold user account as an environment variable MANIFOLD_API_KEY to .Rprofile (using usethis::edit_r_environ() or similar). The key can then be safely retrieved by package functions using manifoldr::get_manifold_api_key() which calls Sys.getenv("MANIFOLD_API_KEY").

Examples

Users can reference the core function manifold_api() with any endpoint using the instructions given in the documentation.

manifoldr::manifold_api(
  endpoint = "/v0/user/ManifoldMarkets", 
  request_type = "GET"
)

A number of convenience functions are also provided. These include functions for specific endpoints and others such as clean_manifold_content(), which will return some output as a data frame with clean variable names.

manifoldr::get_markets(n_markets = 3) |> 
  manifoldr::clean_manifold_content()

Code of Conduct

Please note that the manifoldr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.