Request for Positions on Streaming API yields null in numerous key value pairs
wethinkagile opened this issue · comments
Issue type
- [x ] bug
- [x ] missing functionality
Brief description
Request for Positions on Streaming API and using transform:true
yields empty field null
in JSON key value pairs.
Returned Data Object
Position {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
_fields:
{ symbol: 0,
status: 1,
amount: 2,
basePrice: 3,
marginFunding: 4,
marginFundingType: 5,
pl: 6,
plPerc: 7,
liquidationPrice: 8,
leverage: 9,
placeholder: 10,
id: 11,
mtsCreate: 12,
mtsUpdate: 13,
type: 15,
collateral: 17,
collateralMin: 18,
meta: 19 },
_boolFields: [],
_fieldKeys:
[ 'symbol',
'status',
'amount',
'basePrice',
'marginFunding',
'marginFundingType',
'pl',
'plPerc',
'liquidationPrice',
'leverage',
'placeholder',
'id',
'mtsCreate',
'mtsUpdate',
'type',
'collateral',
'collateralMin',
'meta' ],
symbol: 'tEOSUSD',
status: 'ACTIVE',
amount: 100,
basePrice: 3.345534,
marginFunding: -2.34234234,
marginFundingType: 0,
pl: null,
plPerc: null,
liquidationPrice: null,
leverage: null,
placeholder: null,
id: 6234234234,
mtsCreate: null,
mtsUpdate: null,
type: 0,
collateral: 0,
collateralMin: null,
meta:
{ reason: 'TRADE',
order_id: 123456677,
order_id_oppo: 1234555,
user_id_oppo: 2232,
liq_stage: null,
trade_price: '3.57',
trade_amount: '-10.0' } }
Fields gone missing
pl: null,
plPerc: null,
liquidationPrice: null,
leverage: null,
placeholder: null,
mtsCreate: null,
mtsUpdate: null,
type: 0,
collateral: 0,
collateralMin: null
Question: Where is data?
Steps to reproduce
Conf
config.bfx = new BFX({
apiKey: config.apiKey,
apiSecret: config.apiSecret,
ws: {
autoReconnect: true,
seqAudit: false,
packetWDDelay: 10 * 1500,
transform: true,
manageCandles: true
}
});
Code
ws.on('error', (err) => console.log(err));
ws.on('open', ws.auth.bind(ws));
ws.onPositionSnapshot({}, (pos) => {
console.log(pos[0]);
}
Additional Notes:
When I transform: false I get the same fields nullified. The v2 docs state one should employ calc function for the nullified liquidationPrice field. Following that link leads to no conclusion about how to do that and also the other nullified fields are not mentioned. Can you un-nullify these fields please?
@f3rno would you be able to take a look at this one as well when you get the chance?
Thanks for raising the issue @meshfields
+1