Skip to content

alexanu/obadiah

 
 

Repository files navigation

Obadiah

Obadiah (Order Book Analytics Database) is a system consisting of (i) a Python module for capturing raw high-frequency data from an exchange, (ii) a PostgreSQL database for processing & storing the captured data and (iii) the R package for rendering the processed data in the format suitable for visualization by obAnalytics R package.

To access the database one needs to get a signed SSL certificate as described here. Afterwards it is possible to connect:

config <- config::get()
con <- DBI::dbConnect(RPostgres::Postgres(), user=config$user,dbname=config$dbname, host=config$host,
                      port=config$port, sslmode="require", sslrootcert=config$sslrootcert,
                      sslcert=config$sslcert,sslkey=config$sslkey,bigint="numeric")

Having the connection established, one need to choose the exchange, pair and period.

Currently the database contains data from the following exchanges:

library(lubridate, quietly = T, warn.conflicts=F)

start.time <- with_tz(ymd_hms('2019-05-13 17:56:00+03'), tz='Europe/Moscow')
end.time <- with_tz(ymd_hms('2019-05-13 18:00:00+03'), tz='Europe/Moscow')
exchange <- 'Bitfinex'
pair <- 'BTCUSD'

Now the data can be downloaded

depth <- obadiah::depth(con,start.time, end.time, exchange, pair)
spread <- obadiah::spread(con,start.time, end.time, exchange, pair)
trades <- obadiah::trades(con,start.time, end.time, exchange, pair)

and visualized

obAnalytics::plotPriceLevels(depth, spread, trades, start.time = start.time, end.time = end.time )

obadiah provides data for all visualisation functions in obAnalytics package.

depth.summary <- obadiah::depth_summary(con,start.time, end.time, exchange, pair)
obAnalytics::plotVolumePercentiles(depth.summary, start.time = start.time, end.time = end.time )

events <- obadiah::events(con,start.time, end.time, exchange, pair)
obAnalytics::plotEventMap(events, start.time = start.time, end.time = end.time)

obAnalytics::plotVolumeMap(events,  start.time = start.time, end.time = end.time, log.scale = T)

order.book <- obadiah::order_book(con, start.time, exchange, pair)
obAnalytics::plotCurrentDepth(order.book)

Releases

No releases published

Packages

No packages published

Languages

  • PLpgSQL 91.5%
  • R 4.8%
  • Python 3.6%
  • Shell 0.1%