Skip to content

Commit

Permalink
BitMart update 🔥 (#38)
Browse files Browse the repository at this point in the history
The BitMart exchange have updated their futures API to V2. V1 will stop
working 11/30/2024.

* Updated workflow file.
* Updated NEWS.md
  • Loading branch information
serkor1 committed Nov 1, 2024
1 parent b920c7d commit c3b2a0f
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 24 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:

name: R-CMD-check

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand All @@ -29,7 +31,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -47,3 +49,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ inst/doc
/Meta/
docs
playground/

*.html
6 changes: 5 additions & 1 deletion NEWS.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ library(cryptoQuotes)

## General

* `bitmart` has updated their futures API. The backend have been updated accordingly.

* Unit-tests have been updated and now all `get_quote()`-functions are being tested for equality in passed and inferred interval.

## Improvements

## Read and Write `xts`-objects
Expand Down Expand Up @@ -104,7 +108,7 @@ were included. (Issue [#13](https://github.com/serkor1/cryptoQuotes/issues/13))
### Quotes

* Removed `1s` from *Binance spot*
* Removed `3m`, `6h` and `3d` in *Bitmart spot*
* Removed `6h` and `3d` in *Bitmart spot*

These intervals have been removed as they have either been discontinued, or were non-existent.

Expand Down
44 changes: 25 additions & 19 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

## General

- `bitmart` has updated their futures API. The backend have been updated
accordingly.

- Unit-tests have been updated and now all `get_quote()`-functions are
being tested for equality in passed and inferred interval.

## Improvements

## Read and Write `xts`-objects
Expand Down Expand Up @@ -108,7 +114,7 @@ the following exchanges:
### Quotes

- Removed `1s` from *Binance spot*
- Removed `3m`, `6h` and `3d` in *Bitmart spot*
- Removed `6h` and `3d` in *Bitmart spot*

These intervals have been removed as they have either been discontinued,
or were non-existent.
Expand Down Expand Up @@ -184,12 +190,12 @@ tail(
```

#> open_interest
#> 2024-08-16 10:00:00 1840.775
#> 2024-08-16 11:00:00 1845.837
#> 2024-08-16 12:00:00 1837.801
#> 2024-08-16 13:00:00 1836.295
#> 2024-08-16 14:00:00 1836.202
#> 2024-08-16 15:00:00 1838.612
#> 2024-11-01 01:00:00 2468.037
#> 2024-11-01 02:00:00 2439.700
#> 2024-11-01 03:00:00 2472.806
#> 2024-11-01 04:00:00 2468.223
#> 2024-11-01 05:00:00 2400.722
#> 2024-11-01 06:00:00 2396.795

</details>

Expand Down Expand Up @@ -371,12 +377,12 @@ tail(
```

#> funding_rate
#> 2024-08-14 18:00:00 -0.00007811
#> 2024-08-15 02:00:00 -0.00008488
#> 2024-08-15 10:00:00 0.00006339
#> 2024-08-15 18:00:00 -0.00006181
#> 2024-08-16 02:00:00 -0.00011235
#> 2024-08-16 10:00:00 -0.00007387
#> 2024-10-30 09:00:00 1.730275e+12
#> 2024-10-30 17:00:00 1.730304e+12
#> 2024-10-31 01:00:00 1.730333e+12
#> 2024-10-31 09:00:00 1.730362e+12
#> 2024-10-31 17:00:00 1.730390e+12
#> 2024-11-01 01:00:00 1.730419e+12

</details>

Expand All @@ -398,12 +404,12 @@ tail(
```

#> open_interest
#> 2024-08-11 02:00:00 71072.43
#> 2024-08-12 02:00:00 70092.78
#> 2024-08-13 02:00:00 68490.56
#> 2024-08-14 02:00:00 72127.82
#> 2024-08-15 02:00:00 78050.79
#> 2024-08-16 02:00:00 83767.54
#> 2024-10-27 02:00:00 80968.74
#> 2024-10-28 01:00:00 82206.35
#> 2024-10-29 01:00:00 89115.04
#> 2024-10-30 01:00:00 90242.98
#> 2024-10-31 01:00:00 89315.49
#> 2024-11-01 01:00:00 89544.93

</details>

Expand Down
6 changes: 3 additions & 3 deletions R/api_bitmart.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bitmartUrl <- function(
# 1) define baseURL
# for each API
if (futures)
'https://api-cloud.bitmart.com'
'https://api-cloud-v2.bitmart.com'
else
'https://api-cloud.bitmart.com'

Expand Down Expand Up @@ -87,7 +87,7 @@ bitmartIntervals <- function(

interval_label <- c(
'1m',
# '3m',
'3m',
'5m',
'15m',
'30m',
Expand All @@ -103,7 +103,7 @@ bitmartIntervals <- function(

interval_actual <- c(
1,
# 3,
3,
5,
15,
30,
Expand Down
Binary file modified man/figures/NEWS-unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/NEWS-unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/NEWS-unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/NEWS-unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/NEWS-unnamed-chunk-7-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions tests/testthat/test-getQuote.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ testthat::test_that(
label = paste(error_label, "(Test 3)")
)

# 4) test that the inferred interval
# corresponds to the passed interval
testthat::expect_true(
setequal(
interval,
cryptoQuotes:::infer_interval(
output
)
)
)


}

Expand Down

0 comments on commit c3b2a0f

Please sign in to comment.