ccxt: watchOrders does not always return an array (anymore)
Operating System
Ubuntu
Programming Languages
JavaScript
CCXT Version
4.1.72
Description
With the following code:
const data = await exchange.watchOrders(symbol);
console.log(data);
I’ve always received back an array of orders. However, since a few days, some of the users of my application have been getting errors, consistently, when using Binance. I looked at their logs, and this is what’s in ‘data’ in their case:
{
info: {
e: 'executionReport',
E: 1702419340514,
s: 'PAXGBTC',
c: 'x-R4BD3S82d01aef415d4d4dc3bda574',
S: 'BUY',
o: 'LIMIT',
f: 'GTC',
q: '0.00260000',
p: '0.04764000',
P: '0.00000000',
F: '0.00000000',
g: -1,
C: '',
x: 'TRADE',
X: 'FILLED',
r: 'NONE',
i: 123579579,
l: '0.00260000',
z: '0.00260000',
L: '0.04764000',
n: '0.00001491',
N: 'BNB',
T: 1702419340514,
t: 4512804,
I: 250979830,
w: false,
m: false,
M: true,
O: 1702419340514,
Z: '0.00012386',
Y: '0.00012386',
Q: '0.00000000',
W: 1702419340514,
V: 'EXPIRE_MAKER'
},
symbol: 'PAXG/BTC',
id: '123579579',
clientOrderId: 'x-R4BD3S82d01aef415d4d4dc3bda574',
timestamp: 1702419340514,
datetime: '2023-12-12T22:15:40.514Z',
lastTradeTimestamp: 1702419340514,
lastUpdateTimestamp: 1702419340514,
type: 'limit',
timeInForce: 'GTC',
postOnly: false,
reduceOnly: undefined,
side: 'buy',
price: 0.04764,
stopPrice: 0,
triggerPrice: 0,
amount: 0.0026,
cost: 0.00012386,
average: 0.04763846153846154,
filled: 0.0026,
remaining: 0,
status: 'closed',
fee: { cost: 0.00001491, currency: 'BNB' },
trades: [
{
info: [Object],
timestamp: 1702419340514,
datetime: '2023-12-12T22:15:40.514Z',
symbol: 'PAXG/BTC',
id: '4512804',
order: '123579579',
type: 'limit',
takerOrMaker: 'taker',
side: 'buy',
price: 0.04764,
amount: 0.0026,
cost: 0.00012386,
fee: [Object],
fees: [Array]
}
],
fees: [],
takeProfitPrice: undefined,
stopLossPrice: undefined
}
It’s an object, instead of an array of objects, which is causing problems further down my code.
Is this a known issue?
Code
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 15 (3 by maintainers)
@hodlerhacks No problem 🙂, btw 4.1.90 is out, you can update your ccxt version now