/bfx-hf-models-adapter-lowdb

LowDB adapter for the Honey Framework database

Primary LanguageJavaScript

LowDB Adapter for the Honey Framework DB

This is an adapter around lowdb (a lodash-powered JSON database) for the Bitfinex Honey Framework. To use, initialize an instance of the bfx-hf-models database with it as an adapter.

Example:

const HFDBLowDBAdapter = require('bfx-hf-models-adapter-lowdb')
const { schema: HFDBBitfinexSchema } = require('bfx-hf-ext-plugin-bitfinex')
const HFDB = require('bfx-hf-models')

const { LOWDB_FILENAME } = process.env

const db = new HFDB({
  schema: HFDBBitfinexSchema,
  adapter: HFDBLowDBAdapter({
    dbPath: `${__dirname}/../${LOWDB_FILENAME}`,
    schema: HFDBBitfinexSchema,
  }),
})

const { Candle } = db
const candles = await Candle.getAll()

console.log(`read ${candles.length} candles`)