antiddos_fun: Anti DDoS

Description Usage Arguments Details Value Side effect Note See Also Examples

View source: R/utils.R

Description

Wait if necessary before next API call to market (or any other source system) to do not get banned.

Usage

1
2
3
antiddos_fun(source_system, antiddos.sec = getOption("Rbitcoin.antiddos.sec",
  10), antiddos.verbose = getOption("Rbitcoin.antiddos.verbose", 0),
  verbose = getOption("Rbitcoin.verbose", 0))

Arguments

source_system

character, a unique name of source system, could be any name c('kraken','bitstamp','blockchain','alt_bitstamp')

antiddos.sec

numeric time in seconds between API calls on the particular source system, defeault getOption("Rbitcoin.antiddos.sec",10).

antiddos.verbose

integer, Rbitcoin antiddos verbose message. Should be used when user prefer verbose=0 but still wants to see antiddos waiting time.

verbose

integer. Rbitcoin processing messages, print to console if verbose > 0, each subfunction reduce verbose by 1. If missing then getOption("Rbitcoin.verbose",0) is used.

Details

The following options can control antiddos process:

Value

numeric time of wait in seconds.

Side effect

Environment of name Rbitcoin.last_api_call which holds the timestamps of last api call per source_system during the R session.

Note

Rbitcoin built-in antiddos function handle only api calls launched within the current R session. By default it will wait getOption("Rbitcoin.antiddos.sec",10) seconds between calls to the same system. It cache the api calls in Rbitcoin.last_api_call environment object in current workspace. User can provide own custom antiddos function using getOption("Rbitcoin.antiddos.fun",antiddos_fun). This way it is possible to cache last api call in own data storage (like database), this can allow concurrent R sessions + queueing to be handled by the antiddos process. Custom antiddos should return numeric value of time spent on antiddos waiting in seconds.

See Also

market.api.process, wallet_manager

Examples

1
2
3
4
5
6
7
8
## Not run: 
# run below code in a batch
options("Rbitcoin.antiddos.verbose"=1) # alternatively: options("Rbitcoin.verbose" = 3)
market.api.process('kraken',c('BTC','EUR'),'ticker')
market.api.process('kraken',c('BTC','LTC'),'ticker')
options("Rbitcoin.antiddos.verbose"=0)

## End(Not run)

jangorecki/Rbitcoin documentation built on May 18, 2019, 12:24 p.m.