Skip to content

List of lists in crypto

5 messages · Ilya Kipnis, Andre Luiz Tietbohl Ramos, Dirk Eddelbuettel

#
Hello,

This message isn't directly related to finance for it just uses the problem
at hand contextually under the crypto domain.  Thus, I have a data frame
made from exchanges' names and the intervals each exchange provides.  See
below, please.

exchanges.names <- c('binance', 'bitmart', 'bybit', 'crypto.com', 'huobi',
'kraken', 'kucoin', 'mexc')
intervals <- list(list('1s', '1m', '3m', '5m', '15m', '30m', '1h', '2h',
'4h', '6h', '8h', '12h', '1d', '3d', '1w', '1M'),
                  list('1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h',
'6h', '12h', '1d', '3d', '1w'),
                  list('1m', '3m', '5m', '15m', '30m', '1h', '2h',
'4h','6h', '12h', '1d', '1M', '1w'),
                  list('1m', '5m', '15m', '30m', '1h', '2h', '4h', '12h',
'1d', '1w', '2w', '1M'),
                  list('1m', '5m', '15m', '30m', '1h', '4h', '1d', '1w',
'1M'),
                  list('1m', '5m', '15m', '30m', '1h', '4h', '12h', '1d',
'1w'),
                  list('1m', '5m', '15m', '30m', '1h', '2h', '4h', '8h',
'12h', '1d', '1w'),
                  list('1m', '5m', '15m', '30m', '1h', '4h', '8h', '1d',
'1w', '1M')
                  )
exchanges.intervals <- as.data.frame(cbind(exchanges.names, intervals))

exchanges.intervals

  exchanges.names         intervals
1         binance  1s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d,
3d, 1w, 1M
2         bitmart    1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 3d, 1w
3           bybit      1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 1M, 1w
4      crypto.com  1m, 5m, 15m, 30m, 1h, 2h, 4h, 12h, 1d, 1w, 2w, 1M
5           huobi      1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M
6          kraken     1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w
7          kucoin      1m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 1w
8            mexc      1m, 5m, 15m, 30m, 1h, 4h, 8h, 1d, 1w, 1M

Suppose now I want to get the 5m interval from the binance exchange.  While
I can filter the binance row with,

exchanges.intervals[exchanges.names == "binance", ]

 exchanges.names
 intervals
1         binance 1s, 1m, 3m, 5m, *15m*, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d,
3d, 1w, 1M

I don't know how get the fourth element date from the filtered data frame
nested list.  I need to use its data content.
Any help appreciated!

TIA,

--
Andr? Luiz Tietbohl Ramos, PhD
#
If you have a list of lists, the way to access those elements is like this:

Answer <- object[[first_list_index]][[second_list_index]]

On Sat, Feb 7, 2026 at 12:43?PM Andre Luiz Tietbohl Ramos <
andreltramos at gmail.com> wrote:

            

  
  
#
Andre,

You may find that may you get better answers if you "improve" your questions.
One writeup on how to craft good 'minimally verifiable complete examples'
(aka MVCE) ones is

  https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

which you may want to read (fully).  A helpful command is `dput` as it allows
you send (minimal, toy, still representative) data set along with it.

C
#
Hello everyone,

For starters, I want to thank Dirk and Ilya for helping me.  Following
Dirk's suggestion, I'll try to describe the objective better and post a MWE
next.
The main objective is to define a data frame that has all exchanges
available along with the intervals each one of them the provide.

Sys.setenv(TZ = "America/Sao_Paulo")
library(lubridate)
library(dplyr)
library(svDialogs)
library(stringr)
library(tidyverse)
library(rvest)
library(RCurl)
library(reprex)
library(tibble)
library(quantmod)

library(cryptoQuotes)
library(crypto2)
library(cryptotrackr)
library(coinmarketcapr)

exchanges.names <- c('binance', 'bitmart', 'bybit', 'crypto.com', 'huobi',
'kraken', 'kucoin', 'mexc')
intervals <- list(list('1s', '1m', '3m', '5m', '15m', '30m', '1h', '2h',
'4h', '6h', '8h', '12h', '1d', '3d', '1w', '1M'),
                  list('1m', '3m', '5m', '15m', '30m', '1h', '2h',
'4h', '6h', '12h', '1d', '3d', '1w'),
                  list('1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h',
'6h', '12h', '1d', '1M', '1w'),
                  list('1m', '5m', '15m', '30m', '1h', '2h', '4h', '12h',
'1d', '1w', '2w', '1M'),
                  list('1m', '5m', '15m', '30m', '1h', '4h', '1d', '1w',
'1M'),
                  list('1m', '5m', '15m', '30m', '1h', '4h', '12h', '1d',
'1w'),
                  list('1m', '5m', '15m', '30m', '1h', '2h', '4h', '8h',
'12h', '1d', '1w'),
                  list('1m', '5m', '15m', '30m', '1h', '4h', '8h', '1d',
'1w', '1M') )
exchanges.intervals <- as.data.frame(cbind(exchanges.names, intervals))

## filtering for the binance exchange, for example:
selected <- exchanges.intervals[exchanges.names == "binance", ]

This data is below,
[1] "binance"    "bitmart"    "bybit"      "crypto.com" "huobi"
 "kraken"     "kucoin"     "mexc"
[[1]]
[[1]][[1]]
[1] "1s"
...
[[8]]
[[8]][[1]]
[1] "1m"
...
[[8]][[10]]
[1] "1M"
exchanges.names
intervals
1         binance 1s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d,
3d, 1w, 1M
2         bitmart             1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h,
1d, 3d, 1w
3           bybit             1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h,
1d, 1M, 1w
4      crypto.com                 1m, 5m, 15m, 30m, 1h, 2h, 4h, 12h, 1d,
1w, 2w, 1M
5           huobi                              1m, 5m, 15m, 30m, 1h, 4h,
1d, 1w, 1M
6          kraken                             1m, 5m, 15m, 30m, 1h, 4h,
12h, 1d, 1w
7          kucoin                     1m, 5m, 15m, 30m, 1h, 2h, 4h, 8h,
12h, 1d, 1w
8            mexc                          1m, 5m, 15m, 30m, 1h, 4h, 8h,
1d, 1w, 1M
[[1]]
[1] "1s"
...
[[4]]
[1] "5m"
...
[[16]]
[1] "1M"
exchanges.names
intervals
1         binance           1s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h,
12h, 1d, 3d, 1w, 1M

Assume I want the fourth interval from the binance exchange, which is 5
minutes or 5m.
How can I filter or select this data and assign it to a variable, please?
Of course it is quite easy to assign it result to a variable but I don't
know its first part.
I hope what I detailed above will help you.

--
Andr? Luiz Tietbohl Ramos, PhD
On Sat, Feb 7, 2026 at 2:52?PM Dirk Eddelbuettel <edd at debian.org> wrote:

            

  
  
#
On 8 February 2026 at 08:33, Andre Luiz Tietbohl Ramos wrote:
| library(lubridate)
| library(dplyr)
| library(svDialogs)
| library(stringr)
| library(tidyverse)
| library(rvest)
| library(RCurl)
| library(reprex)
| library(tibble)
| library(quantmod)
| 
| library(cryptoQuotes)
| library(crypto2)
| library(cryptotrackr)
| library(coinmarketcapr)

So after I explain what a MCVE example is, and let's stress minimal here, you
post a snippet requiring 14 packages? And likely API keys? Interesting choice.

And if I may, sending 40% of the list traffic here

  > tb <- table(readLines(pipe("grep 'From: ' r-sig-finance | tail -50")))
  > tail(tb[order(tb)],1)

  From: Andre Luiz Tietbohl Ramos <andreltramos at gmail.com> 
                                                        20 
  >

may not get you where you want to go. I cannot speak for everybody here but I
think most are happy to 'help you learn to help yourself', but I don't you
can expect us to be your assistants doing custom programming for you.

For this question Ilya already explained to you how to peek into a nested 
list. I would start there.


Dirk

| 
| exchanges.names <- c('binance', 'bitmart', 'bybit', 'crypto.com', 'huobi',
| 'kraken', 'kucoin', 'mexc')
| intervals <- list(list('1s', '1m', '3m', '5m', '15m', '30m', '1h', '2h',
| '4h', '6h', '8h', '12h', '1d', '3d', '1w', '1M'),
|                   list('1m', '3m', '5m', '15m', '30m', '1h', '2h',
| '4h', '6h', '12h', '1d', '3d', '1w'),
|                   list('1m', '3m', '5m', '15m', '30m', '1h', '2h', '4h',
| '6h', '12h', '1d', '1M', '1w'),
|                   list('1m', '5m', '15m', '30m', '1h', '2h', '4h', '12h',
| '1d', '1w', '2w', '1M'),
|                   list('1m', '5m', '15m', '30m', '1h', '4h', '1d', '1w',
| '1M'),
|                   list('1m', '5m', '15m', '30m', '1h', '4h', '12h', '1d',
| '1w'),
|                   list('1m', '5m', '15m', '30m', '1h', '2h', '4h', '8h',
| '12h', '1d', '1w'),
|                   list('1m', '5m', '15m', '30m', '1h', '4h', '8h', '1d',
| '1w', '1M') )
| exchanges.intervals <- as.data.frame(cbind(exchanges.names, intervals))
| 
| ## filtering for the binance exchange, for example:
| selected <- exchanges.intervals[exchanges.names == "binance", ]
| 
| This data is below,
| 
| > exchanges.names
| [1] "binance"    "bitmart"    "bybit"      "crypto.com" "huobi"
|  "kraken"     "kucoin"     "mexc"
| > intervals
| [[1]]
| [[1]][[1]]
| [1] "1s"
| ...
| [[8]]
| [[8]][[1]]
| [1] "1m"
| ...
| [[8]][[10]]
| [1] "1M"
| 
| > exchanges.intervals
|   exchanges.names
| intervals
| 1         binance 1s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d,
| 3d, 1w, 1M
| 2         bitmart             1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h,
| 1d, 3d, 1w
| 3           bybit             1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h,
| 1d, 1M, 1w
| 4      crypto.com                 1m, 5m, 15m, 30m, 1h, 2h, 4h, 12h, 1d,
| 1w, 2w, 1M
| 5           huobi                              1m, 5m, 15m, 30m, 1h, 4h,
| 1d, 1w, 1M
| 6          kraken                             1m, 5m, 15m, 30m, 1h, 4h,
| 12h, 1d, 1w
| 7          kucoin                     1m, 5m, 15m, 30m, 1h, 2h, 4h, 8h,
| 12h, 1d, 1w
| 8            mexc                          1m, 5m, 15m, 30m, 1h, 4h, 8h,
| 1d, 1w, 1M
| >
| 
| > exchanges.intervals[[2]][[1]]
| [[1]]
| [1] "1s"
| ...
| [[4]]
| [1] "5m"
| ...
| [[16]]
| [1] "1M"
| >
| 
| > exchanges.intervals[exchanges.names == "binance", ]
|   exchanges.names
| intervals
| 1         binance           1s, 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h,
| 12h, 1d, 3d, 1w, 1M
| 
| Assume I want the fourth interval from the binance exchange, which is 5
| minutes or 5m.
| How can I filter or select this data and assign it to a variable, please?
| Of course it is quite easy to assign it result to a variable but I don't
| know its first part.
| I hope what I detailed above will help you.
| 
| --
| Andr? Luiz Tietbohl Ramos, PhD
| 
|
| On Sat, Feb 7, 2026 at 2:52?PM Dirk Eddelbuettel <edd at debian.org> wrote:
| 
| >
| > Andre,
| >
| > You may find that may you get better answers if you "improve" your
| > questions.
| > One writeup on how to craft good 'minimally verifiable complete examples'
| > (aka MVCE) ones is
| >
| >
| > https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
| >
| > which you may want to read (fully).  A helpful command is `dput` as it
| > allows
| > you send (minimal, toy, still representative) data set along with it.
| >
| > C
| >
| > --
| > dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
| >