data-source
data-source for stock data
Install
$ npm install data-source --save
Usage
const dataSource = connection: host: '127.0.0.1' user: 'root' password: '' database: '' code: 'sz300131' loader: Loader // Whether the given time of the span is trading // - span: day, will not check hours and minutes // - true const span = dataSource const // `Number` open price open // `Number` the highest price high // `Number` the lowest price low // `Number` the close price close // `Number` the volume of transactions volume // `Date` time time} = await span console
span.get(time)
Gets a single datum
- time
Date|Array<Date>
Returns Candlestick|null
span.get(...times)
Returns Array<Candlestick>
span.between([from, to])
- from
Date
the closed left of the region - to
Date
the closed right of the region
Returns Array<Candlestick>
data between a period.
span.latest(limit)
- limit
Number
limit the number of results.
Returns Array<Candlestick>
span.sync([from, to])
Sync data from from
to to
, and update db, and update last-updated record.
License
MIT