Skip to content

Commit 8d4be2c

Browse files
authored
Patch (#48)
## 📚 What? This PR consists of two bug-fixes --- one user-reported, and one reported by CRAN: 1. The `Funding Rate` from Binance API were returning vectors of dates instead of the Funding Rate. Thank you Michael; I would have put your name in the release docs but I do not have your Github-handle. 2. The docs were generating NOTE on CRAN when embedding {plotly}-graps via HTML and Latex. The plots have been deleted as they are already shown in the examples. ## Repository and pkg-specific changes * Added a Makefile for more flexible control-flow of the pkg-building process. * Streamlined CoinMarketCap input so it follows the remaining syntax, ie `1M` instead of `30d`. * Cleaned up unused .png-files > [!NOTE] > > See commit history for more details.
1 parent 8901d5e commit 8d4be2c

113 files changed

Lines changed: 2915 additions & 3350 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.Rbuildignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ playground
1717
^data-raw$
1818
^codemeta\.json$
1919
NEWS.Rmd
20-
.vdoc.r
20+
.vdoc.r
21+
Makefile

CRAN-SUBMISSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Version: 1.3.2
2-
Date: 2024-11-07 05:41:59 UTC
3-
SHA: e12973201b0a1173d20ccc6d89b774a4f68b95cf
1+
Version: 1.3.3
2+
Date: 2025-09-15 18:41:18 UTC
3+
SHA: 4f3649c1905e82ab62e390aff687b81b3088eaf8

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: cryptoQuotes
22
Title: Open Access to Cryptocurrency Market Data, Sentiment Indicators and Interactive Charts
3-
Version: 1.3.2
3+
Version: 1.3.3
44
Authors@R: c(
55
person(
66
given = "Serkan",

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Package information
2+
package_name := $(shell grep "^Package:" DESCRIPTION | sed "s/Package: //")
3+
package_version := $(shell grep "^Version:" DESCRIPTION | sed "s/Version: //")
4+
tarball_location := $(package_name)_$(package_version).tar.gz
5+
6+
## default target
7+
.PHONY: help
8+
help:
9+
@grep -h -E '^[[:space:]]*[A-Za-z0-9_.-]+:.*?## .*$$' $(MAKEFILE_LIST) \
10+
| sed -E 's/^[[:space:]]*//' \
11+
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[1;34m%-15s\033[m \xE2\x80\x94 %s\n", $$1, $$2}'
12+
13+
build: ## Build the R package
14+
@Rscript --verbose -e "devtools::document()"
15+
@R CMD build . && R CMD INSTALL $(tarball_location)
16+
@Rscript -e "rmarkdown::render('README.Rmd', output_format = rmarkdown::github_document(html_preview = FALSE), clean = TRUE)"
17+
@Rscript -e "rmarkdown::render('NEWS.Rmd', output_format = rmarkdown::github_document(html_preview = FALSE), clean = TRUE)"
18+
19+
check: ## Check the R package
20+
@Rscript --verbose -e "devtools::document()"
21+
@R CMD build . && R CMD check $(tarball_location)
22+
23+
test: ## Run tests
24+
@Rscript --verbose -e "library(cryptoQuotes); testthat::test_dir('tests/testthat')"
25+
26+
clean: ## Remove artifacts
27+
@rm -rf $(tarball_location)
28+
@rm -rf $(package_name).Rcheck
29+
@Rscript -e "remove.packages('$(package_name)')"
30+
31+
fmt: ## Format code
32+
@air format .
33+
34+
pkgdown-build: ## Build {pkgdown} documentation
35+
@Rscript --verbose -e "devtools::document()"
36+
@Rscript -e "pkgdown::clean_site()"
37+
@Rscript -e "pkgdown::init_site()"
38+
@Rscript -e "pkgdown::build_site()"
39+
40+
pkgdown-preview: ## Preview {pkgdown} documetation
41+
@Rscript -e "pkgdown::preview_site()"

NEWS.Rmd

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,34 @@ knitr::opts_chunk$set(
2323
library(cryptoQuotes)
2424
```
2525

26-
# Version 1.3.2
26+
# Version 1.3.3
2727

2828
## General
2929

30-
* `bitmart` has updated their futures API. The backend have been updated accordingly.
31-
32-
* Unit-tests have been updated and now all `get_quote()`-functions are being tested for equality in passed and inferred interval.
33-
34-
## Improvements
35-
36-
## [NEW FEATURE] Global Market Capitalization
30+
### New features
3731

3832
* The `get_mktcap()`-function returns the global market capitalization of the cryptocurrency market. It also has the option to return altcoin market capitalization.
3933

4034
```{r}
41-
# get market
42-
# capitalization
43-
tail(get_mktcap())
35+
# get market capitalization
36+
tail(
37+
get_mktcap()
38+
)
4439
```
4540

41+
## Bugfixes
42+
43+
* A bug in the funding rates from Binance have been fixed. The returned values was the time indices of the json-array, not the actual rates.
44+
45+
# Version 1.3.2
46+
47+
## General
48+
49+
* `bitmart` has updated their futures API. The backend have been updated accordingly.
50+
51+
* Unit-tests have been updated and now all `get_quote()`-functions are being tested for equality in passed and inferred interval.
52+
53+
## Improvements
4654

4755
## [NEW FEATURE] Read and Write `xts`-objects
4856

NEWS.md

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
11

22
<!-- NEWS.md is generated from NEWS.Rmd. Please edit that file -->
33

4+
# Version 1.3.3
5+
6+
## General
7+
8+
### New features
9+
10+
- The `get_mktcap()`-function returns the global market capitalization
11+
of the cryptocurrency market. It also has the option to return altcoin
12+
market capitalization.
13+
14+
``` r
15+
# get market capitalization
16+
tail(
17+
get_mktcap()
18+
)
19+
```
20+
21+
#> marketcap volume
22+
#> 2025-09-12 05:00:00 4.015436e+12 163237690580
23+
#> 2025-09-13 05:00:00 4.072732e+12 169107128392
24+
#> 2025-09-14 05:00:00 4.062633e+12 137318394600
25+
#> 2025-09-15 05:00:00 4.056822e+12 128029319974
26+
#> 2025-09-16 05:00:00 4.004271e+12 163269852880
27+
#> 2025-09-17 05:00:00 4.027473e+12 146323890322
28+
29+
## Bugfixes
30+
31+
- A bug in the funding rates from Binance have been fixed. The returned
32+
values was the time indices of the json-array, not the actual rates.
33+
434
# Version 1.3.2
535

636
## General
@@ -13,7 +43,7 @@
1343

1444
## Improvements
1545

16-
## Read and Write `xts`-objects
46+
## \[NEW FEATURE\] Read and Write `xts`-objects
1747

1848
- `read_xts()` and `write_xts()` reads and stores `xts`-objects. These
1949
functions are essentially just wrappers of `zoo::read.zoo()` and
@@ -62,7 +92,7 @@ chart(
6292
)
6393
```
6494

65-
<img src="man/figures/NEWS-unnamed-chunk-2-1.png" style="display: block; margin: auto;" />
95+
<img src="man/figures/NEWS-unnamed-chunk-3-1.png" style="display: block; margin: auto;" />
6696
</details>
6797
<details>
6898
<summary>
@@ -86,7 +116,7 @@ chart(
86116
)
87117
```
88118

89-
<img src="man/figures/NEWS-unnamed-chunk-3-1.png" style="display: block; margin: auto;" />
119+
<img src="man/figures/NEWS-unnamed-chunk-4-1.png" style="display: block; margin: auto;" />
90120
</details>
91121

92122
### Supported Exchanges (Issue [\#14](https://github.com/serkor1/cryptoQuotes/issues/14))
@@ -167,7 +197,7 @@ chart(
167197
)
168198
```
169199

170-
<img src="man/figures/NEWS-unnamed-chunk-4-1.png" style="display: block; margin: auto;" />
200+
<img src="man/figures/NEWS-unnamed-chunk-5-1.png" style="display: block; margin: auto;" />
171201
</details>
172202

173203
### Expanded Support
@@ -190,12 +220,12 @@ tail(
190220
```
191221

192222
#> open_interest
193-
#> 2024-11-02 10:00:00 2394.876
194-
#> 2024-11-02 11:00:00 2389.595
195-
#> 2024-11-02 12:00:00 2396.225
196-
#> 2024-11-02 13:00:00 2403.175
197-
#> 2024-11-02 14:00:00 2418.193
198-
#> 2024-11-02 15:00:00 2398.648
223+
#> 2025-09-18 02:00:00 2707.242
224+
#> 2025-09-18 03:00:00 2730.265
225+
#> 2025-09-18 04:00:00 2731.936
226+
#> 2025-09-18 05:00:00 2711.744
227+
#> 2025-09-18 06:00:00 2708.016
228+
#> 2025-09-18 07:00:00 2706.681
199229

200230
</details>
201231

@@ -233,7 +263,7 @@ chart(
233263
)
234264
```
235265

236-
<img src="man/figures/NEWS-unnamed-chunk-6-1.png" style="display: block; margin: auto;" />
266+
<img src="man/figures/NEWS-unnamed-chunk-7-1.png" style="display: block; margin: auto;" />
237267
</details>
238268

239269
### Documentation
@@ -348,7 +378,7 @@ chart(
348378
)
349379
```
350380

351-
<img src="man/figures/NEWS-unnamed-chunk-7-1.png" style="display: block; margin: auto;" />
381+
<img src="man/figures/NEWS-unnamed-chunk-8-1.png" style="display: block; margin: auto;" />
352382

353383
### Exchange Support
354384

@@ -377,12 +407,12 @@ tail(
377407
```
378408

379409
#> funding_rate
380-
#> 2024-10-31 17:00:00 1.730390e+12
381-
#> 2024-11-01 01:00:00 1.730419e+12
382-
#> 2024-11-01 09:00:00 1.730448e+12
383-
#> 2024-11-01 17:00:00 1.730477e+12
384-
#> 2024-11-02 01:00:00 1.730506e+12
385-
#> 2024-11-02 09:00:00 1.730534e+12
410+
#> 2025-09-16 10:00:00 6.991e-05
411+
#> 2025-09-16 18:00:00 6.472e-05
412+
#> 2025-09-17 02:00:00 6.972e-05
413+
#> 2025-09-17 10:00:00 8.441e-05
414+
#> 2025-09-17 18:00:00 6.303e-05
415+
#> 2025-09-18 02:00:00 4.941e-05
386416

387417
</details>
388418

@@ -403,13 +433,7 @@ tail(
403433
)
404434
```
405435

406-
#> open_interest
407-
#> 2024-10-28 01:00:00 82206.35
408-
#> 2024-10-29 01:00:00 89115.04
409-
#> 2024-10-30 01:00:00 90242.98
410-
#> 2024-10-31 01:00:00 89315.49
411-
#> 2024-11-01 01:00:00 89544.93
412-
#> 2024-11-02 01:00:00 84087.60
436+
#> open_interest
413437

414438
</details>
415439

R/ATOM.R

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,3 @@
2727
#' sub = list(volume())
2828
#' )
2929
"ATOM"
30-
31-
32-
33-

R/FUN.R

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#' @export
3131

3232
remove_bound <- function(
33-
xts,
34-
bounds = c('upper')) {
35-
33+
xts,
34+
bounds = c('upper')
35+
) {
3636
# check if bounds are correctly
3737
# specified
3838
# if (!grepl(x = bounds, pattern = 'upper|lower|both')) {
@@ -59,11 +59,10 @@ remove_bound <- function(
5959
bounds,
6060
upper = xts[-nrow(xts)],
6161
lower = xts[-1],
62-
both = xts[-c(1,nrow(xts))]
62+
both = xts[-c(1, nrow(xts))]
6363
)
6464

6565
xts
66-
6766
}
6867

6968
# split window; #####
@@ -90,10 +89,10 @@ remove_bound <- function(
9089
#'
9190
#' @export
9291
split_window <- function(
93-
xts,
94-
by,
95-
bounds = 'upper') {
96-
92+
xts,
93+
by,
94+
bounds = 'upper'
95+
) {
9796
assert(
9897
inherits(xts, "xts"),
9998
error_message = c(
@@ -111,10 +110,9 @@ split_window <- function(
111110
lapply(
112111
X = seq_along(by),
113112
FUN = function(i) {
114-
115113
# 1) extract both
116114
# indices
117-
index <- by[i:(i+1)]
115+
index <- by[i:(i + 1)]
118116

119117
# 2) subset using
120118
# window and cut the upper
@@ -123,16 +121,14 @@ split_window <- function(
123121
xts = stats::window(
124122
x = xts,
125123
start = index[1],
126-
end = index[2]
124+
end = index[2]
127125
),
128126
bounds = bounds
129127
)
130128

131129
xts
132-
133130
}
134131
)
135-
136132
}
137133

138134
# calibrate window; ####
@@ -157,10 +153,10 @@ split_window <- function(
157153
#'
158154
#' @export
159155
calibrate_window <- function(
160-
list,
161-
FUN,
162-
...) {
163-
156+
list,
157+
FUN,
158+
...
159+
) {
164160
assert(
165161
inherits(list, "list"),
166162
error_message = c(
@@ -185,7 +181,6 @@ calibrate_window <- function(
185181
...
186182
)
187183
)
188-
189184
}
190185

191186
# script end;

0 commit comments

Comments
 (0)