react-native-show-market-binance
Version:
Package to show crypto market symbols information
20 lines (18 loc) • 488 B
text/typescript
export function createWebSocket(symbol: string | null, pathUrl: string) {
const BASE = "wss://stream.binance.com:9443/ws";
return new WebSocket(BASE + "/" + (!!symbol ? symbol : "") + pathUrl);
}
export const miniTickerTransform = (string: string) => {
const m = JSON.parse(string);
return {
eventType: m.e,
eventTime: m.E,
symbol: m.s,
lastPrice: m.c,
open: m.o,
high: m.h,
low: m.l,
volume: m.v,
volumeQuote: m.q,
};
};