tardis-dev
Advanced tools
Comparing version 10.1.5 to 10.1.6
@@ -13,6 +13,6 @@ export declare const EXCHANGES: readonly ["bitmex", "deribit", "binance-futures", "binance", "ftx", "okex-futures", "okex-options", "okex-swap", "okex", "huobi-dm", "huobi-dm-swap", "huobi", "bitfinex-derivatives", "bitfinex", "bitfinex-alts", "bitflyer", "cryptofacilities", "kraken", "bitstamp", "coinbase", "gemini", "coinflex", "bybit", "phemex", "okcoin", "hitbtc", "binance-jersey", "binance-us", "binance-dex"]; | ||
'okex-options': string[]; | ||
binance: readonly ["trade", "aggTrade", "ticker", "depth", "depthSnapshot", "bookTicker"]; | ||
'binance-jersey': readonly ["trade", "aggTrade", "ticker", "depth", "depthSnapshot", "bookTicker"]; | ||
binance: readonly ["trade", "aggTrade", "ticker", "depth", "depthSnapshot", "bookTicker", "recentTrades"]; | ||
'binance-jersey': readonly ["trade", "aggTrade", "ticker", "depth", "depthSnapshot", "bookTicker", "recentTrades"]; | ||
'binance-dex': readonly ["trades", "marketDiff", "depthSnapshot"]; | ||
'binance-us': readonly ["trade", "aggTrade", "ticker", "depth", "depthSnapshot", "bookTicker"]; | ||
'binance-us': readonly ["trade", "aggTrade", "ticker", "depth", "depthSnapshot", "bookTicker", "recentTrades"]; | ||
bitfinex: readonly ["trades", "book", "raw_book"]; | ||
@@ -32,4 +32,4 @@ 'bitfinex-alts': readonly ["trades", "book", "raw_book"]; | ||
coinflex: string[]; | ||
phemex: readonly ["book", "trades", "market24h"]; | ||
phemex: readonly ["book", "trades", "market24h", "spot_market24h"]; | ||
}; | ||
//# sourceMappingURL=consts.d.ts.map |
@@ -34,3 +34,3 @@ "use strict"; | ||
]; | ||
const BINANCE_CHANNELS = ['trade', 'aggTrade', 'ticker', 'depth', 'depthSnapshot', 'bookTicker']; | ||
const BINANCE_CHANNELS = ['trade', 'aggTrade', 'ticker', 'depth', 'depthSnapshot', 'bookTicker', 'recentTrades']; | ||
const BINANCE_DEX_CHANNELS = ['trades', 'marketDiff', 'depthSnapshot']; | ||
@@ -136,3 +136,3 @@ const BITFINEX_CHANNELS = ['trades', 'book', 'raw_book']; | ||
const HUOBI_DM_SWAP_CHANNELS = ['depth', 'detail', 'trade']; | ||
const PHEMEX_CHANNELS = ['book', 'trades', 'market24h']; | ||
const PHEMEX_CHANNELS = ['book', 'trades', 'market24h', 'spot_market24h']; | ||
const BYBIT_CHANNELS = ['trade', 'instrument_info', 'orderBookL2_25', 'insurance', 'orderBook_200']; | ||
@@ -139,0 +139,0 @@ const HITBTC_CHANNELS = ['updateTrades', 'snapshotTrades', 'snapshotOrderbook', 'updateOrderbook']; |
@@ -11,2 +11,14 @@ "use strict"; | ||
}; | ||
function getPriceScale(symbol) { | ||
if (symbol.startsWith('s')) { | ||
return 1e8; | ||
} | ||
return 1e4; | ||
} | ||
function getQtyScale(symbol) { | ||
if (symbol.startsWith('s')) { | ||
return 1e8; | ||
} | ||
return 1; | ||
} | ||
exports.phemexTradesMapper = { | ||
@@ -26,9 +38,10 @@ canHandle(message) { | ||
for (const [timestamp, side, priceEp, qty] of message.trades) { | ||
const symbol = message.symbol; | ||
yield { | ||
type: 'trade', | ||
symbol: message.symbol, | ||
symbol, | ||
exchange: 'phemex', | ||
id: undefined, | ||
price: priceEp / 10000, | ||
amount: qty, | ||
price: priceEp / getPriceScale(symbol), | ||
amount: qty / getQtyScale(symbol), | ||
side: side === 'Buy' ? 'buy' : 'sell', | ||
@@ -41,6 +54,6 @@ timestamp: fromNanoSecondsToDate(timestamp), | ||
}; | ||
const mapBookLevel = ([priceEp, qty]) => { | ||
const mapBookLevelForSymbol = (symbol) => ([priceEp, qty]) => { | ||
return { | ||
price: priceEp / 10000, | ||
amount: qty | ||
price: priceEp / getPriceScale(symbol), | ||
amount: qty / getQtyScale(symbol) | ||
}; | ||
@@ -61,2 +74,4 @@ }; | ||
*map(message, localTimestamp) { | ||
const symbol = message.symbol; | ||
const mapBookLevel = mapBookLevelForSymbol(symbol); | ||
yield { | ||
@@ -63,0 +78,0 @@ type: 'book_change', |
@@ -20,2 +20,5 @@ "use strict"; | ||
return filter.symbols.map((symbol) => { | ||
if (symbol.startsWith('S')) { | ||
symbol = symbol.charAt(0).toLocaleLowerCase() + symbol.slice(1); | ||
} | ||
return { | ||
@@ -22,0 +25,0 @@ id: id++, |
{ | ||
"name": "tardis-dev", | ||
"version": "10.1.5", | ||
"version": "10.1.6", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=12" |
@@ -33,3 +33,3 @@ export const EXCHANGES = [ | ||
const BINANCE_CHANNELS = ['trade', 'aggTrade', 'ticker', 'depth', 'depthSnapshot', 'bookTicker'] as const | ||
const BINANCE_CHANNELS = ['trade', 'aggTrade', 'ticker', 'depth', 'depthSnapshot', 'bookTicker', 'recentTrades'] as const | ||
const BINANCE_DEX_CHANNELS = ['trades', 'marketDiff', 'depthSnapshot'] as const | ||
@@ -156,3 +156,3 @@ const BITFINEX_CHANNELS = ['trades', 'book', 'raw_book'] as const | ||
const PHEMEX_CHANNELS = ['book', 'trades', 'market24h'] as const | ||
const PHEMEX_CHANNELS = ['book', 'trades', 'market24h', 'spot_market24h'] as const | ||
@@ -159,0 +159,0 @@ const BYBIT_CHANNELS = ['trade', 'instrument_info', 'orderBookL2_25', 'insurance', 'orderBook_200'] as const |
@@ -14,2 +14,18 @@ import { Mapper, PendingTickerInfoHelper } from './mapper' | ||
function getPriceScale(symbol: string) { | ||
if (symbol.startsWith('s')) { | ||
return 1e8 | ||
} | ||
return 1e4 | ||
} | ||
function getQtyScale(symbol: string) { | ||
if (symbol.startsWith('s')) { | ||
return 1e8 | ||
} | ||
return 1 | ||
} | ||
export const phemexTradesMapper: Mapper<'phemex', Trade> = { | ||
@@ -31,9 +47,11 @@ canHandle(message: PhemexTradeMessage) { | ||
for (const [timestamp, side, priceEp, qty] of message.trades) { | ||
const symbol = message.symbol | ||
yield { | ||
type: 'trade', | ||
symbol: message.symbol, | ||
symbol, | ||
exchange: 'phemex', | ||
id: undefined, | ||
price: priceEp / 10000, | ||
amount: qty, | ||
price: priceEp / getPriceScale(symbol), | ||
amount: qty / getQtyScale(symbol), | ||
side: side === 'Buy' ? 'buy' : 'sell', | ||
@@ -47,6 +65,6 @@ timestamp: fromNanoSecondsToDate(timestamp), | ||
const mapBookLevel = ([priceEp, qty]: PhemexBookLevel) => { | ||
const mapBookLevelForSymbol = (symbol: string) => ([priceEp, qty]: PhemexBookLevel) => { | ||
return { | ||
price: priceEp / 10000, | ||
amount: qty | ||
price: priceEp / getPriceScale(symbol), | ||
amount: qty / getQtyScale(symbol) | ||
} | ||
@@ -70,2 +88,4 @@ } | ||
*map(message: PhemexBookMessage, localTimestamp: Date): IterableIterator<BookChange> { | ||
const symbol = message.symbol | ||
const mapBookLevel = mapBookLevelForSymbol(symbol) | ||
yield { | ||
@@ -72,0 +92,0 @@ type: 'book_change', |
@@ -18,2 +18,6 @@ import { Filter } from '../types' | ||
return filter.symbols.map((symbol) => { | ||
if (symbol.startsWith('S')) { | ||
symbol = symbol.charAt(0).toLocaleLowerCase() + symbol.slice(1) | ||
} | ||
return { | ||
@@ -20,0 +24,0 @@ id: id++, |
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
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
702352
12424