tardis-client
Advanced tools
Comparing version 1.2.1 to 1.2.3
@@ -1,2 +0,2 @@ | ||
export declare const EXCHANGES: readonly ["bitmex", "coinbase", "deribit", "cryptofacilities", "bitstamp", "kraken", "okex", "binance", "binance-jersey", "binance-dex", "bitfinex", "ftx"]; | ||
export declare const EXCHANGES: readonly ["bitmex", "binance", "binance-futures", "deribit", "bitstamp", "coinbase", "cryptofacilities", "kraken", "bitfinex", "bitfinex-derivatives", "okex", "binance-jersey", "binance-dex", "ftx", "gemini", "bitflyer"]; | ||
export declare type Exchange = typeof EXCHANGES[number]; | ||
@@ -16,2 +16,6 @@ export declare const EXCHANGE_CHANNELS_INFO: { | ||
ftx: readonly ["orderbook", "trades"]; | ||
gemini: readonly ["trade", "l2_updates", "auction_open", "auction_indicative", "auction_result"]; | ||
bitflyer: readonly ["lightning_board_snapshot", "lightning_board", "lightning_ticker", "lightning_executions"]; | ||
'binance-futures': string[]; | ||
'bitfinex-derivatives': readonly ["trades", "book", "status"]; | ||
}; | ||
@@ -18,0 +22,0 @@ export declare type FilterForExchange = { |
@@ -5,13 +5,17 @@ "use strict"; | ||
'bitmex', | ||
'binance', | ||
'binance-futures', | ||
'deribit', | ||
'bitstamp', | ||
'coinbase', | ||
'deribit', | ||
'cryptofacilities', | ||
'bitstamp', | ||
'kraken', | ||
'bitfinex', | ||
'bitfinex-derivatives', | ||
'okex', | ||
'binance', | ||
'binance-jersey', | ||
'binance-dex', | ||
'bitfinex', | ||
'ftx' | ||
'ftx', | ||
'gemini', | ||
'bitflyer' | ||
]; | ||
@@ -89,2 +93,6 @@ const BINANCE_CHANNELS = ['trade', 'ticker', 'depth', 'miniTicker', 'depthSnapshot']; | ||
const FTX_CHANNELS = ['orderbook', 'trades']; | ||
const GEMINI_CHANNELS = ['trade', 'l2_updates', 'auction_open', 'auction_indicative', 'auction_result']; | ||
const BITFLYER_CHANNELS = ['lightning_board_snapshot', 'lightning_board', 'lightning_ticker', 'lightning_executions']; | ||
const BINANCE_FUTURES_CHANNELS = ['aggTrade', 'ticker', 'depth', 'markPrice', 'depthSnapshot']; | ||
const BITFINEX_DERIV_CHANNELS = ['trades', 'book', 'status']; | ||
exports.EXCHANGE_CHANNELS_INFO = { | ||
@@ -102,4 +110,8 @@ bitmex: BITMEX_CHANNELS, | ||
bitfinex: BITFINEX_CHANNELS, | ||
ftx: FTX_CHANNELS | ||
ftx: FTX_CHANNELS, | ||
gemini: GEMINI_CHANNELS, | ||
bitflyer: BITFLYER_CHANNELS, | ||
'binance-futures': BINANCE_FUTURES_CHANNELS, | ||
'bitfinex-derivatives': BITFINEX_DERIV_CHANNELS | ||
}; | ||
//# sourceMappingURL=consts.js.map |
@@ -146,6 +146,6 @@ "use strict"; | ||
if (!filter.channel || consts_1.EXCHANGE_CHANNELS_INFO[exchange].includes(filter.channel) === false) { | ||
throw new Error(`Invalid "filters[].channel" argument: ${exchange}. Please provide one of the following channels: ${consts_1.EXCHANGE_CHANNELS_INFO[exchange].join(', ')}.`); | ||
throw new Error(`Invalid "filters[].channel" argument: ${filter.channel}. Please provide one of the following channels: ${consts_1.EXCHANGE_CHANNELS_INFO[exchange].join(', ')}.`); | ||
} | ||
if (filter.symbols && Array.isArray(filter.symbols) === false) { | ||
throw new Error(`Invalid "filters[].symbols" argument: ${exchange}. Please provide array of symbol strings`); | ||
throw new Error(`Invalid "filters[].symbols" argument: ${filter.symbols}. Please provide array of symbol strings`); | ||
} | ||
@@ -152,0 +152,0 @@ } |
{ | ||
"name": "tardis-client", | ||
"version": "1.2.1", | ||
"version": "1.2.3", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=12" |
@@ -8,7 +8,7 @@ # tardis-client | ||
Provides fast easy to use wrapper for more level [REST API](https://docs.tardis.dev/api#http-api) with local file based caching build in. | ||
Provides fast easy to use wrapper for more low level [HTTP API](https://docs.tardis.dev/api#http-api) with local file based caching build in. | ||
## Installation | ||
Requires Node.js v12 installed. | ||
Requires Node.js v12+ installed. | ||
@@ -25,3 +25,3 @@ ```sh | ||
// replay method returns async iterator | ||
// replay method returns async iterable | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of | ||
@@ -71,3 +71,3 @@ | ||
| `apiKey` (optional) | `string or undefined` | `undefined` | optional `string` containing API key for [tardis.dev](https://tardis.dev) API. If not provided only first day of each month of data is accessible (free access) | | ||
| `cacheDir` (optional) | `string` | `<os.tmpdir>/.tardis-cache` | optional `string` with path to local dir that will be used as cache location. If not provided default `temp` dir for given OS isused | | ||
| `cacheDir` (optional) | `string` | `<os.tmpdir>/.tardis-cache` | optional `string` with path to local dir that will be used as cache location. If not provided default `temp` dir for given OS will be used. | | ||
@@ -95,8 +95,7 @@ Example: | ||
Replays data feed for given replay options as [async iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of). | ||
Replays historical market data messages for given replay options. | ||
Returns [async iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) with objects of `{ localTimestamp: Date; message: object }` type. | ||
Returns iterator of `{ localTimestamp: Date; message: object }` type. | ||
- `localTimestamp` is a JS Date object specyfying when message has been received from the exchange real-time data feed. | ||
- `localTimestamp` is a date when message has been received in ISO 8601 format with 100 nano second resolution. | ||
- `message` is and JSON object/array with exactly the same structure as provided by particular exchange. | ||
@@ -108,6 +107,6 @@ | ||
| -------------------- | ---------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| `exchange` | `string` | - | requested exchange name. Check out [allowed echanges](https://github.com/tardis-dev/node-client/blob/master/src/consts.ts) | | ||
| `exchange` | `string` | - | requested exchange name - see [allowed exchanges](https://github.com/tardis-dev/node-client/blob/master/src/consts.ts) list | | ||
| `from` | `string` | - | requested UTC start date of data feed - (eg: `2019-04-05` or `2019-05-05T00:00:00.000Z`) | | ||
| `to` | `string` | - | requested UTC end date of data feed - (eg: `2019-04-05` or `2019-05-05T00:00:00.000Z`) | | ||
| `filters` (optional) | `{channel:string, symbols?: string[]}[]` | undefined | optional filters of requested data feed. Use [/exchanges/:/exchange](https://docs.tardis.dev/api#exchanges-exchange) API call to get allowed channel names and symbols for requested exchange | | ||
| `filters` (optional) | `{channel:string, symbols?: string[]}[]` | undefined | optional filters of requested data feed. Use [/exchanges/:exchange](https://docs.tardis.dev/api#exchanges-exchange) API call to get allowed channel names and symbols for requested exchange | | ||
@@ -171,8 +170,6 @@ Examples: | ||
Replays data feed for given replay options as [async iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of). | ||
Replays historical market data messages for given replay options. | ||
Accepts the same options as `replay` method. | ||
Returns [async iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) with objects of `{ localTimestamp: Buffer; message: Buffer }` type. It's faster than `replay` (no decoding to objects/dates, just raw buffers), but may manual decoding from buffers depending on the use case. | ||
Returns iterator of `{ localTimestamp: Buffer; message: Buffer }` type, it's faster than `replay` (no decoding to objects/dates, just raw buffers), but may manual decoding from buffers depending on the use case. | ||
Example: | ||
@@ -179,0 +176,0 @@ |
export const EXCHANGES = [ | ||
'bitmex', | ||
'binance', | ||
'binance-futures', | ||
'deribit', | ||
'bitstamp', | ||
'coinbase', | ||
'deribit', | ||
'cryptofacilities', | ||
'bitstamp', | ||
'kraken', | ||
'bitfinex', | ||
'bitfinex-derivatives', | ||
'okex', | ||
'binance', | ||
'binance-jersey', | ||
'binance-dex', | ||
'bitfinex', | ||
'ftx' | ||
'ftx', | ||
'gemini', | ||
'bitflyer' | ||
] as const | ||
@@ -100,2 +104,10 @@ | ||
const GEMINI_CHANNELS = ['trade', 'l2_updates', 'auction_open', 'auction_indicative', 'auction_result'] as const | ||
const BITFLYER_CHANNELS = ['lightning_board_snapshot', 'lightning_board', 'lightning_ticker', 'lightning_executions'] as const | ||
const BINANCE_FUTURES_CHANNELS = ['aggTrade', 'ticker', 'depth', 'markPrice', 'depthSnapshot'] | ||
const BITFINEX_DERIV_CHANNELS = ['trades', 'book', 'status'] as const | ||
export const EXCHANGE_CHANNELS_INFO = { | ||
@@ -113,3 +125,7 @@ bitmex: BITMEX_CHANNELS, | ||
bitfinex: BITFINEX_CHANNELS, | ||
ftx: FTX_CHANNELS | ||
ftx: FTX_CHANNELS, | ||
gemini: GEMINI_CHANNELS, | ||
bitflyer: BITFLYER_CHANNELS, | ||
'binance-futures': BINANCE_FUTURES_CHANNELS, | ||
'bitfinex-derivatives': BITFINEX_DERIV_CHANNELS | ||
} | ||
@@ -116,0 +132,0 @@ |
@@ -203,3 +203,3 @@ import os from 'os' | ||
throw new Error( | ||
`Invalid "filters[].channel" argument: ${exchange}. Please provide one of the following channels: ${EXCHANGE_CHANNELS_INFO[ | ||
`Invalid "filters[].channel" argument: ${filter.channel}. Please provide one of the following channels: ${EXCHANGE_CHANNELS_INFO[ | ||
exchange | ||
@@ -211,3 +211,3 @@ ].join(', ')}.` | ||
if (filter.symbols && Array.isArray(filter.symbols) === false) { | ||
throw new Error(`Invalid "filters[].symbols" argument: ${exchange}. Please provide array of symbol strings`) | ||
throw new Error(`Invalid "filters[].symbols" argument: ${filter.symbols}. Please provide array of symbol strings`) | ||
} | ||
@@ -214,0 +214,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96347
1253
197