Bugfix on fill event price parsing.
This commit is contained in:
parent
d35e0107b1
commit
3f6c14c111
|
@ -557,13 +557,16 @@ function parseFillLog(
|
||||||
|
|
||||||
let lotSizes = perpLotSizes[mangoGroupPk][perpMarket.name]
|
let lotSizes = perpLotSizes[mangoGroupPk][perpMarket.name]
|
||||||
|
|
||||||
|
const nativeToUi = Math.pow(10, perpMarket.baseDecimals - perpMarket.quoteDecimals);
|
||||||
|
const lotsToNative = lotSizes.quoteLotSize / lotSizes.baseLotSize
|
||||||
|
|
||||||
const fill = {
|
const fill = {
|
||||||
event_num: instructionNum,
|
event_num: instructionNum,
|
||||||
maker: eventData.maker.toString(),
|
maker: eventData.maker.toString(),
|
||||||
maker_fee: new I80F48(eventData.makerFee).toNumber(),
|
maker_fee: new I80F48(eventData.makerFee).toNumber(),
|
||||||
maker_order_id: eventData.makerOrderId.toString(),
|
maker_order_id: eventData.makerOrderId.toString(),
|
||||||
maker_client_order_id: eventData.makerClientOrderId.toString(),
|
maker_client_order_id: eventData.makerClientOrderId.toString(),
|
||||||
price: eventData.price.toNumber() / lotSizes.quoteLotSize,
|
price: eventData.price.toNumber() * lotsToNative * nativeToUi,
|
||||||
|
|
||||||
// Storing both price and quantity in UI terms to be consistent with db
|
// Storing both price and quantity in UI terms to be consistent with db
|
||||||
quantity: eventData.quantity.toNumber() * lotSizes.baseLotSize / Math.pow(10, perpMarket.baseDecimals),
|
quantity: eventData.quantity.toNumber() * lotSizes.baseLotSize / Math.pow(10, perpMarket.baseDecimals),
|
||||||
|
|
Loading…
Reference in New Issue