1.0.0 • Published 4 years ago

rescuer-datastore v1.0.0

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
4 years ago

Rescuer Datastore

Purpose

The purpose of rescuer-datastore is to store and complete current database.

Inputs : Trade(s)

{ exchange: 'coinbase',
  instrument: 'XBT-EUR',
  ts_reception: 1571748293049736700,
  timestamp: 1571748292815828000,
  type: 'buy',
  rate: '7434.9',
  amount: '0.01251328',
  tradeId: '943270d754b9d55d71dbc0e691471fc753ad24da' }

Outputs : Boolean

store = true or false

Usage

Configuration

Configurations must be defined as the following format : ./configs.

In the configuration file it has to be defined requesters and time laps in ms bettween each request to rescue_trade.

Requester must be formated as the following example: 'kraken'.

//Example
{time: 1000,
 exchanges: ['kraken']}

Running

Phase 0 : service tests in regular lapse time slider.start(storeTradesHandler, time), if trades are stored in database await trades.testDB().

Phase 1 : if rescue_trade is not null, then service retrieve the first batch of 1000 trades await trades.getTrades() with same instrument and exchange than the first one in the database table.

Phase 2 : service extracts trades already stored in their specific table, bettween timstamp frame set up by trades previously extracted (example: kaken_XBTEUR_trades) await trades.getTradesIfExist(). If global datas differ bettwen the timestamp frame service erases trades already stored and replace them with those coming from rescue_trade table. Trades extrated from recue_trades are at any cases deleted from the table await trades.deleteTradesUpdate();

Phase 3: service restarts cycle until rescue_trade get empty slider.start(storeTradesHandler, time).

Build

sudo docker build -t rescuer-datastore --build-arg NPM_TOKEN=c7af0a4e-74b9-464e-be7f-27479d9ab677 --build-arg NATS_IP=172.17.0.1 --build-arg NATS_PORT=4222 --build-arg NAMESPACE='koinju' .
sudo docker run rescuer-datastore