Generic function to plot different objects returned by some Rbitcoin functions. The plot produce basic visualization of the data. The plots will likely be subject to change in future versions.
1 2 3
object to be plotted, result of Rbitcoin function, currently supported:
list of arguments to be passed to target graphic device function, ex.
additional params to be passed to plot function.
integer. Rbitcoin processing messages, print to console if
format in the
export.args list defines the export format, default
"svg", tested and supported formats are
"png", other might work also.
To use custom export filename just pass the filename arg to export.args list. By default
NULL results timestamped by last
wallet_id filename. Use custom
export.args[['filename']] with no file extension while declaring.
You may notice the legend is different on exported files. The same legend was not scalling well between export to file and plot to interactive device.
The plot function for
order_book do not process the data, it plot the data as is, so it may result poor visibility due to the data itself (ex.
order_book containing asks with enormously high price). See examples how this can be handled.
To be able to track wallet assets value over time user needs to use
archive_write=TRUE at least twice in wallet manager processing (with non-NA measures). Using the cryptocurrency which do not have any exchange path to
value_currency will result
value. Error on data downloading from external sources (wallets or exchange rates) will also result
NA. Any wallet processing batch which will contain at least one
NA measure will be omitted from plot. If you have some crypto not currenctly supported you may extend dictionary for more currencies or provide its value as manual source to
wallet_manager already calculated in common value currency, remember to comment out the previous source which returns the
To plot wallet manager data load wallet archive data, see examples.
Plotting function will produce dashboard panel to track different measures of your assets and its value. Use
mask if you want to share the results to somebody, it will overwrite value with value ratio.
Target value currency is taken from the last execution of
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
## Not run: # plot trades data from kraken's api trades <- market.api.process('kraken',c('BTC','EUR'),'trades') Rbitcoin.plot(trades) Rbitcoin.plot(trades,export=TRUE,col='blue') #export to file, plot trades line in blue # plot order book data from kraken's api order_book <- market.api.process('kraken',c('BTC','EUR'),'order_book') Rbitcoin.plot(order_book) # plot order book with filtering margins based on order price order_book <- market.api.process('bitmarket',c('BTC','PLN'),'order_book') pct <- 0.75 mid <- ((order_book[["asks"]][1,price] + order_book[["bids"]][1,price]) / 2) order_book[["asks"]] <- order_book[["asks"]][price <= mid * (1+pct)] order_book[["bids"]] <- order_book[["bids"]][price >= mid * (1-pct)] Rbitcoin.plot(order_book) # plot wallet manager data (from local archive) - for details read ?waller_manager wallet_dt <- wallet_manager(archive_write=F, archive_read=T) #readRDS("wallet_archive.rds") Rbitcoin.plot(wallet_dt) # plot in R Rbitcoin.plot(wallet_dt[value>=100 | is.na(value)]) # filter out low value from plot Rbitcoin.plot(wallet_dt, export=T) # export to svg # mask value with ratio value and save to png Rbitcoin.plot(wallet_dt,mask=T,export=T, export.args=list(format="png", width = 2*480, height = 2*480, units = "px", pointsize = 18)) # mask value with ratio and mask bitcoin addresses Rbitcoin.plot(wallet_dt[,.SD][location_type=="blockchain",location := "*address*"], mask=T, export=T) ## End(Not run)