Feed 'N' - Settlement transactions
Settlement transaction feed
Requests
{"event": "bind", "feed": "N"}
For detailed settlement transactions description
settlementTransactions{"event": "unbind", "feed": "N"}
Feed handling
settlementTransaction = [
0: counterpartyId (Efx::ClientId)
1: currencyName (string)
2: amount (Efx::Size)
3: settlementOrderId (Efx::OrderId)
4: comment (string)
5: createdAt (Efx::Timestamp)
6: txId (string)
7: sentAt (Efx::Timestamp)
8: transactionFlags (Efx::Flags)
9: transactionMoment (Efx::Timestamp)
10: transaction (Efx::DealId)
11: networkFee (unsigned int64)
12: network (string)
]
For detailed settlement transaction description
settlementTransactions// snapshot
['N', 0, 'S', [
nextDealOrSettlementOrTransactionId (Efx::DealId),
array of incoming settlementTransaction,
array of outgoing settlementTransaction
]]
// add settlement transactions
['N', 0, '+', [
array of new incoming settlementTransaction,
array of new outgoing settlementTransaction
]]
// modify settlement transactions
['N', 0, 'M', [
array of received incoming settlementTransaction,
array of received outgoing settlementTransaction
]]
// commited settlement transactions
['N', 0, 'D', [
array of commited incoming settlementTransaction,
array of commited outgoing settlementTransaction
]]
// remove settlement transactions
['N', 0, '-', [
array of removed incoming settlementTransaction,
array of removed outgoing settlementTransaction
]]
// failed to subscribe
['N', 0, 'Z', 2]
// unsubscribed
['N', 0, 'U', 0]
applyToSnapshot(prevSnapshot, feed, action, data) {
switch (action) {
case 'S' : {
snapshot = [data[0], [...data[1]], [...data[2]]]
break
}
case '+' : {
for (let incoming of data[0]) {
snapshot[1].push(incoming)
}
for (let outgoing of data[1]) {
snapshot[2].push(outgoing)
}
break
}
case 'M' : {
for (let incoming of data[0]) {
for (var i in snapshot[1]) {
if (snapshot[1][i][3] == incoming[3]) {
snapshot[1][i] = incoming
break
}
}
}
for (let outgoing of data[1]) {
for (var i in snapshot[2]) {
if (snapshot[2][i][3] == outgoing[3]) {
snapshot[2][i] = outgoing
break
}
}
}
break
}
case 'D' :
case '-' : {
for (let incoming of data[0]) {
if (incoming[10]) {
snapshot[0] = incoming[10] + 1
}
for (var i in snapshot[1]) {
if (snapshot[1][i][3] == incoming[3]) {
snapshot[1].splice(i, 1)
break
}
}
}
for (let outgoing of data[1]) {
if (outgoing[10]) {
snapshot[0] = outgoing[10] + 1
}
for (var i in snapshot[2]) {
if (snapshot[2][i][3] == outgoing[3]) {
snapshot[2].splice(i, 1)
break
}
}
}
break
}
}
return prevSnapshot
}
Last updated