Skip to content

Commit

Permalink
improvement: for binance liquidations use Order Last Filled Quantity …
Browse files Browse the repository at this point in the history
…for amount field
  • Loading branch information
thaaddeus committed Oct 25, 2023
1 parent 63926fa commit 1518819
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/mappers/binance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export class BinanceLiquidationsMapper implements Mapper<'binance-futures' | 'bi
exchange: this._exchange,
id: undefined,
price: Number(binanceLiquidation.p),
amount: Number(binanceLiquidation.z), // use Order Filled Accumulated Quantity
amount: Number(binanceLiquidation.l), // Order Last Filled Quantity
side: binanceLiquidation.S === 'SELL' ? 'sell' : 'buy',
timestamp: new Date(binanceLiquidation.T),
localTimestamp: localTimestamp
Expand Down Expand Up @@ -533,6 +533,7 @@ type BinanceFuturesForceOrderData = {
p: string // Price
ap: string // Average Price
X: 'FILLED' // Order Status
l: '0.014' // Order Last Filled Quantity
T: 1568014460893 // Order Trade Time
z: string // Order Filled Accumulated Quantity
}
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/mappers.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@ Array [
exports[`mappers map binance futures messages 13`] = `
Array [
Object {
"amount": 0.014,
"amount": 0.015,
"exchange": "binance-futures",
"id": undefined,
"localTimestamp": 2019-09-01T00:00:01.275Z,
Expand Down
2 changes: 1 addition & 1 deletion test/mappers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2976,7 +2976,7 @@ describe('mappers', () => {
p: '4793.91',
ap: '4706.04',
X: 'FILLED',
l: '0.014',
l: '0.015',
z: '0.014',
T: 1584059031421
}
Expand Down

2 comments on commit 1518819

@ericsoderstrom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thaaddeus do you remember why this change was made / why it's an improvement?

@thaaddeus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was requested by some of the Tardis customers.

Please sign in to comment.