0.4.6 • Published 5 years ago

@debased/client v0.4.6

Weekly downloads
2
License
SEE LICENSE IN <L...
Repository
gitlab
Last release
5 years ago

@debased/client

Client around a debased database

Install

npm install @debased/client

Use

Populator

Agents responsible for streaming data into a debased-database through a debased-server are called populators. The simplest way to write a populator is to send BrandedRecords through a Publishable to a debased-client's write-stream

import DebasedClient from '@debased/client'
import TimeseriesRecord from 'timeseries-record'
import RecordContext from '@strong-roots-capital/record-context'
import BrandedRecord from '@strong-roots-capital/BrandedRecord'
import Publishable from '@strong-roots-capital/publishable'

const dummyContext: RecordContext = {exchange: 'realExchange', timeframe: 0, tradepair: 'populator'}
const debasedClient = new DebasedClient('localhost', 1576, {context: dummyContext})

const publishable = new Publishable<BrandedRecord>({objectMode: true})
publishable.pipe(debasedClient.createWriteStream())

streamRecordsFromExchange(myContext, recordHandler.bind(myContext))

function recordHandler(context: RecordContext, record: TimeseriesRecord) {
    const brandedRecord: BrandedRecord = {record: record, context: context}
    publishable.publish(brandedRecord)
}

Bots

Agents who act on data published by a debased-server from its debased-database are called bots. The simplest way to write a bot is to use the server's createReadStream

TODO

Related

TODO

  • implement tests
0.4.6

5 years ago

0.4.5

5 years ago