binance_open_interest_hist

Get the historical open interest data for a trading pair.

  • Github function here.
color_header <- "#FFC525"
color_header_background <- "#1E2224"
color_row_background <- "#F3F7F9"
color_args <- "#F2AB27"

api_refs <- c(binance_ref_doc("fapi", "#open-interest", 'fapi'),
              binance_ref_doc("dapi", "#open-interest", 'dapi'), 
              binance_ref_doc("eapi", "#open-interest", 'eapi'))
api_refs <- paste0(api_refs, collapse = ", ")

docs <- dplyr::tibble(
  Argument = c(paste0('<b style="color:', color_args, '">pair</b>'), 
               paste0('<b style="color:', color_args, '">api</b>'), 
               paste0('<b style="color:', color_args, '">from</b>'), 
               paste0('<b style="color:', color_args, '">to</b>'), 
               paste0('<b style="color:', color_args, '">quiet</b>')), 
  Type = c('<i>Character<i/>', 
           '<i>Character<i/>', 
           '<i>Character<i/>', 
           '<i>Character<i/>', 
           '<i>Logical</i>'), 
  Description = c('Trading pair', 
                  'Reference API',
                  'Start time for historical data', 
                  'End time for historical data',  
                  'If <b style="color:green">TRUE</b> suppress informational and warnings'),
  Options = c("<b>None</b>", 
              api_refs, 
              "<b>None</b>",
              "<b>None</b>",
              '<b style="color:green">TRUE</b>/<b style="color:red">FALSE</b>'),
  Default = c("<b>None</b>", 
              "fapi", 
              '`Sys.time()-lubridate::days(30)`',
              '`Sys.time()`',
              '<b style="color:red">FALSE</b>'))
DT::datatable(docs, 
              rownames = FALSE, 
              filter = "none", 
              escape = FALSE,
              options = list(
                dom = 't',
                ordering = FALSE,
                initComplete = DT::JS(
                    "function(settings, json) {",
                    paste0("$(this.api().table().header()).css({'background-color': '", 
                           color_header_background, "', 'color': '",
                           color_header, "'});", "}"))
              )) %>% 
  DT::formatStyle(c(1,2,3),target='row', backgroundColor = color_row_background)

Example: USD-m (fapi)

Show the code
library(binancer)
open_interest <- binance_open_interest_hist("BTCUSDT", api = "fapi", from = Sys.Date() - 1)

df_open_interest <- head(open_interest, n = 5)

Example: COIN-m (fapi)

Show the code
library(binancer)
open_interest <- binance_open_interest_hist("BTCUSD", api = "dapi", from = Sys.Date() - 1) 
Back to top

Citation

BibTeX citation:
@online{sartini2024,
  author = {Sartini, Beniamino},
  date = {2024-06-18},
  url = {https://cryptoverser.org/binancer-docs/binance_open_interest_hist.html},
  langid = {en}
}
For attribution, please cite this work as:
Sartini, Beniamino. 2024. June 18, 2024. https://cryptoverser.org/binancer-docs/binance_open_interest_hist.html.