Skip to content

Commit

Permalink
Rebranding, efficiency and end-user upgrades 🚀 🚀 (#28)
Browse files Browse the repository at this point in the history
* Filter power-up 🔼 🔼

All get_*-family of function are usings stats::window() instead of {xts}-syntax. Local tests shows that {stats} is faster. About 5-10 times faster.

Bug-fix:

If interval were incorrectly specificed the error-message werent rendering properly. This were due to a missing quotation-mark.

* Binance, Assertand Fetch Power-Ups ⬆️ ⬆️

Assert:

The assert function has been reworked so it only evaluates all statements if any of the values are FALSE. The update is twice as fast as before in cases where all statements are TRUE.

Fetch:

The fetch()-function is now less defensive and uses only a single try-catch statement.

GET:

The GET()-function is now less defensive

Binance:

All possible parameters have been vectorized and/or simplified where possible.

General:

All ifelse()-functions have been replaced with if () else as these are faster.
For cases where more than two if statements are needed, a switch-function is used instead (with default values)

* ByBit Power-Ups ⬆️ ⬆️

The ByBit API has been upgraded to reduce overhead on if-statements and
interval look-up times.

See commit 8373bee for more details if there is any interest.

> [!NOTE]
>
> All tests have passed locally.

* Bitmart Power-Ups ⬆️ ⬆️

The Bitmart API has been upgraded to reduce overhead on if-statements and
interval look-up times.

See commit 8373bee for more details if there is any interest.

> [!NOTE]
>
> All tests have passed locally.

* Crypto.com Power-Ups ⬆️ ⬆️

The Crypto.com API has been upgraded to reduce overhead on if-statements and
interval look-up times.

See commit 8373bee for more details if there is any interest.

> [!NOTE]
>
> All tests have passed locally.

* MEXC Power-Ups + Bugfix ⬆️ ⬆️

MEXC API have been reworked and vectorized. See commit 8373bee
for more infor.

Bugfix 🔧

There was a small bug in the SPOT market where values to dates would
be passed as scientific values.

* Kraken Power-Ups ⬆️ ⬆️

Kraken API have been reworked and vectorized. See commit 8373bee for more information.

> [!NOTE]
>
> All tests have passed locally.

* KuCoin Power-Ups ⬆️ ⬆️

MEXC API have been reworked and vectorized. See commit 8373bee
for more information.

Possible bug has been fixed 🔧 (See commit 5a02a40, its similar)

* Huobi (HTX) Power-Ups ⬆️ ⬆️

Huobi API have been reworked and vectorized. See commit 5a02a40
for more information.

> [!NOTE]
>
> All tests have passed locally.

* Endpoint Power-Ups ⬆️ ⬆️

The available_*-family of functions have been reworked (slightly) and has really minor performance gain. At this stage there is no room for improvement on the coding side - however there are places where redundant codes could be removed, but they act as a defensive measure. These will be addressed at a way later stage.

* {cryptoQuotes} Power-Ups  ⬆️ ⬆️

New feature:
------------

Reading and writing xts-objects using read.zoo and write.zoo under the hood.
See the read_xts()- and write_xts()-functions for more details.

Added unit tests and updated NEWS.md

This function is dedicated to @gokberkcan7 🔥

* Updated README ⬆️ ⬆️

The README.md now uses data.table for the most part - all checks passes despite not being imported.
The exchanges have been recoded, and the available endpoints are being updated dynamically.

* Updated description and version bump ⬆️ ⬆️

The package has a more suitable title and description to reflect it's actual purpose and usecase.

* Removed redundant operators ⬆️

These include, but are not limited to, c(1) and c(foo). In cases like these the values ahve been chaged to 1 and foo.

Minor typos and such have been fixed in the README.me

* Updated vignette ⬆️ ⬆️

The custom chart vignette is now more user-friendly. It was targeted developers before
  • Loading branch information
serkor1 authored Jul 7, 2024
1 parent fddaeb8 commit b046f44
Show file tree
Hide file tree
Showing 37 changed files with 1,807 additions and 2,038 deletions.
34 changes: 22 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
Package: cryptoQuotes
Title: A Streamlined Access to Cryptocurrency OHLC-V Market Data and Sentiment Indicators
Version: 1.3.1
Title: Open Access to Cryptocurrency Market Data, Sentiment Indicators and Interactive Charts
Version: 1.3.2
Authors@R: c(
person("Serkan", "Korkmaz", , "[email protected]", role = c("cre", "aut", "ctb", "cph"),
comment = c(ORCID = "0000-0002-5052-0982")),
person("Jonas", "Cuzulan Hirani", , "[email protected]", role = "ctb",
comment = c(ORCID = "0000-0002-9512-1993"))
person(
given = "Serkan",
family = "Korkmaz",
email = "[email protected]",
role = c("cre", "aut", "ctb", "cph"),
comment = c(ORCID = "0000-0002-5052-0982")
),
person(
given = "Jonas",
family = "Cuzulan Hirani",
email = "[email protected]",
role = "ctb",
comment = c(ORCID = "0000-0002-9512-1993")
)
)
Description:
This high-level API client offers a streamlined access to public cryptocurrency market data and sentiment indicators. It features OHLC-V (Open, High, Low, Close, Volume) that comes
with granularity ranging from seconds to months and essential sentiment indicators to develop and backtest trading strategies, or conduct detailed market analysis. By interacting directly with
the major cryptocurrency exchanges this package ensures a reliable, and stable, flow of market information, eliminating the need for complex, low-level API interactions or webcrawlers.
Description:
This high-level API client provides open access to cryptocurrency market data, sentiment indicators, and interactive charting tools.
The data is sourced from major cryptocurrency exchanges via cURL and processed using the xts package. The data comes in open, high, low, and close (OHLC) format with flexible granularity, ranging from seconds to months.
This flexibility makes it ideal for developing and backtesting trading strategies or conducting detailed market analysis.
License: GPL (>= 2)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand All @@ -24,14 +34,14 @@ Suggests:
tidyverse
Config/testthat/edition: 3
Imports:
cli (>= 3.6.2),
cli (>= 3.6.3),
curl (>= 5.2.1),
jsonlite (>= 1.8.8),
lifecycle (>= 1.0.4),
plotly (>= 4.10.4),
TTR (>= 0.24.4),
utils,
xts (>= 0.13.2),
xts (>= 0.14.0),
zoo (>= 1.8-12)
Depends:
R (>= 4.0.0)
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export(lsr)
export(macd)
export(ohlc)
export(pline)
export(read_xts)
export(remove_bound)
export(rsi)
export(sma)
Expand All @@ -31,6 +32,7 @@ export(split_window)
export(volume)
export(vwap)
export(wma)
export(write_xts)
export(zlema)
importFrom(TTR,BBands)
importFrom(curl,has_internet)
Expand Down
11 changes: 7 additions & 4 deletions NEWS.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ library(cryptoQuotes)

## Improvements

## Read and Write `xts`-objects

* `read_xts()` and `write_xts()` reads and stores `xts`-objects. These functions are essentially just wrappers of `zoo::read.zoo()` and `zoo::write.zoo()`. Thank you @gokberkcan7 for the suggestion.

### Charting

* The `chart()`-function are now exported as `.svg`-images in 4k resolution via the `modebar`.
* The `chart()`-function are now more interactive and supports drawing lines and rectangles via the `modebar`. It is also possible to interactively change the `title` and `subtitle` by double clicking these (Thank you @andreltr for the suggestion. See [Discussion](https://github.com/serkor1/cryptoQuotes/discussions/19).
* The `chart()`-function are now more interactive and supports drawing lines and rectangles via the `modebar`. It is also possible to interactively change the `title` and `subtitle` by double clicking these (Thank you @andreltr for the suggestion. See [Discussion](https://github.com/serkor1/cryptoQuotes/discussions/19)).
* The `chart()`-function now has a new option `static` that is equal to `FALSE` by default. If `FALSE` the chart can be edited, annotated and explored interactively.
* The `chart()`-function now has a new option `palette` that is set to "hawaii" by default. See [hcl.pals()] for accepted values.
* The `chart()`-function now has a new option `scale` that is set to 1 by default. Scales
#' all fonts on the chart.
* The `chart()`-function now has a new option `palette` that is set to "hawaii" by default. See `hcl.pals()` for accepted values.
* The `chart()`-function now has a new option `scale` that is set to 1 by default. Scales all fonts on the chart.

<details>
<summary>Static set to FALSE (Default Palette) </summary>
Expand Down
48 changes: 27 additions & 21 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

## Improvements

## Read and Write `xts`-objects

- `read_xts()` and `write_xts()` reads and stores `xts`-objects. These
functions are essentially just wrappers of `zoo::read.zoo()` and
`zoo::write.zoo()`. Thank you @gokberkcan7 for the suggestion.

### Charting

- The `chart()`-function are now exported as `.svg`-images in 4k
Expand All @@ -15,14 +21,14 @@
lines and rectangles via the `modebar`. It is also possible to
interactively change the `title` and `subtitle` by double clicking
these (Thank you @andreltr for the suggestion. See
[Discussion](https://github.com/serkor1/cryptoQuotes/discussions/19).
[Discussion](https://github.com/serkor1/cryptoQuotes/discussions/19)).
- The `chart()`-function now has a new option `static` that is equal to
`FALSE` by default. If `FALSE` the chart can be edited, annotated and
explored interactively.
- The `chart()`-function now has a new option `palette` that is set to
“hawaii” by default. See \[hcl.pals()\] for accepted values.
“hawaii” by default. See `hcl.pals()` for accepted values.
- The `chart()`-function now has a new option `scale` that is set to 1
by default. Scales \#all fonts on the chart.
by default. Scales all fonts on the chart.

<details>
<summary>
Expand Down Expand Up @@ -174,12 +180,12 @@ tail(
```

#> open_interest
#> 2024-07-01 19:00:00 2517.698
#> 2024-07-01 20:00:00 2538.052
#> 2024-07-01 21:00:00 2532.170
#> 2024-07-01 22:00:00 2523.813
#> 2024-07-01 23:00:00 2530.148
#> 2024-07-02 00:00:00 2519.876
#> 2024-07-07 10:00:00 2474.917
#> 2024-07-07 11:00:00 2522.876
#> 2024-07-07 12:00:00 2522.405
#> 2024-07-07 13:00:00 2520.337
#> 2024-07-07 14:00:00 2514.162
#> 2024-07-07 15:00:00 2512.482

</details>

Expand Down Expand Up @@ -361,12 +367,12 @@ tail(
```

#> funding_rate
#> 2024-06-30 02:00:00 1e-04
#> 2024-06-30 10:00:00 1e-04
#> 2024-06-30 18:00:00 1e-04
#> 2024-07-01 02:00:00 1e-04
#> 2024-07-01 10:00:00 1e-04
#> 2024-07-01 18:00:00 1e-04
#> 2024-07-05 18:00:00 1.762e-05
#> 2024-07-06 02:00:00 5.729e-05
#> 2024-07-06 10:00:00 7.512e-05
#> 2024-07-06 18:00:00 3.250e-05
#> 2024-07-07 02:00:00 8.164e-05
#> 2024-07-07 10:00:00 1.000e-04

</details>

Expand All @@ -388,12 +394,12 @@ tail(
```

#> open_interest
#> 2024-06-26 02:00:00 75584.46
#> 2024-06-27 02:00:00 74876.90
#> 2024-06-28 02:00:00 74906.65
#> 2024-06-29 02:00:00 78522.05
#> 2024-06-30 02:00:00 80535.81
#> 2024-07-01 02:00:00 85675.69
#> 2024-07-02 02:00:00 81856.18
#> 2024-07-03 02:00:00 84473.52
#> 2024-07-04 02:00:00 88025.51
#> 2024-07-05 02:00:00 88552.55
#> 2024-07-06 02:00:00 83117.83
#> 2024-07-07 02:00:00 80177.38

</details>

Expand Down
Loading

0 comments on commit b046f44

Please sign in to comment.