Adds coin values from CoinGecko API to Kraken staking transactions
Arguments
- input
A
string
with the path to the exported Kraken ledgers data or adata.frame
with the same strucutre as the kraken ledgers export.- base_currency
A
string
with the prefered currency in which the coin value will be returned. One ofc("eur", "usd")
. If the result will be imported in Portfolio Performance, this should be the same as the base currency set there.- input_type
A
string
which defines what kind of input you are passing. If you are not passing a exportedledgers.csv
from Kraken the data needs the columnstime
,type
,asset
andamount.
Value
A tibble with the following columns:
date
(date): date of the staking transaction;time
(character) time of the staking transaction;type
(character): staking;asset
(character): Kraken coin abbreviation;amount
(double): amount of staked coins;fee
(double): transaction fee;price
(double): coin price inbase_currency
, as ofdate
;currency
(character): currency of coin value;
Examples
kraken_data <- data.frame(
time = c("2022-04-05 03:24:26", "2022-04-11 17:51:44", "2022-04-12 02:43:49",
"2022-04-18 09:07:51", "2022-04-19 02:46:48", "2022-04-25 09:11:56",
"2022-04-26 02:48:12"),
type = "staking",
asset = c("TRX.S", "ADA.S", "TRX.S", "ADA.S", "TRX.S", "ADA.S", "TRX.S"),
amount = c(0.4, 0.55, 10.76, 0.55, 10.77, 0.55, 10.79)
)
r <- kraken_staking(kraken_data, input_type = "data.frame")
head(r, 10)
#> # A tibble: 7 × 7
#> date time type asset amount price currency
#> <date> <chr> <chr> <chr> <dbl> <dbl> <chr>
#> 1 2022-04-05 03:24:26 staking trx 0.4 0.0645 eur
#> 2 2022-04-11 17:51:44 staking ada 0.55 0.954 eur
#> 3 2022-04-12 02:43:49 staking trx 10.8 0.0535 eur
#> 4 2022-04-18 09:07:51 staking ada 0.55 0.856 eur
#> 5 2022-04-19 02:46:48 staking trx 10.8 0.0571 eur
#> 6 2022-04-25 09:11:56 staking ada 0.55 0.820 eur
#> 7 2022-04-26 02:48:12 staking trx 10.8 0.0610 eur