Closed Shutch closed 4 years ago
Exchange Liquid
Subscription type Trades
Describe the bug When creating the trade object from the Liquid trade websocket response the price and amount are truncated to the default 2 decimal places using toFixed() because a precision is not specified
https://github.com/altangent/ccxws/blob/master/src/exchanges/liquid-client.js#L284
To Reproduce Steps to reproduce the behavior:
const ccxws = require("ccxws"); const binance = new ccxws.liquid(); const market = { id: "celbtc", // liquid IDs from ccxt do not work, websocket stream uses [base][quote] format base: "CEL", // standardized base symbol for Bitcoin quote: "BTC", // standardized quote symbol for Tether }; // handle trade events binance.on("trade", trade => console.log(trade)); // subscribe to trades binance.subscribeTrades(market);
Example output: ccxws:
Trade { exchange: 'Liquid', quote: 'BTC', base: 'CEL', tradeId: '333106471', unix: 1593603406000, side: 'buy', price: '0', amount: '482', buyOrderId: undefined, sellOrderId: undefined }
JSON response from liquid:
{ "channel": "executions_cash_celbtc", "data": "{\"created_at\":1593603406,\"id\":333106471,\"price\":0.00005167,\"quantity\":482,\"taker_side\":\"buy\"}", "event": "created" }
Expected behavior Precision for price and amount is preserved from the exchange, which is 8 digits of precision for both.
Thanks for the issue and PR! Will release shortly.
Released in https://github.com/altangent/ccxws/releases/tag/v0.35.2. Thanks!
Exchange Liquid
Subscription type Trades
Describe the bug When creating the trade object from the Liquid trade websocket response the price and amount are truncated to the default 2 decimal places using toFixed() because a precision is not specified
https://github.com/altangent/ccxws/blob/master/src/exchanges/liquid-client.js#L284
To Reproduce Steps to reproduce the behavior:
Example output: ccxws:
JSON response from liquid:
Expected behavior Precision for price and amount is preserved from the exchange, which is 8 digits of precision for both.