Bugfix on fill event price parsing.
This commit is contained in:
parent
d35e0107b1
commit
3f6c14c111
|
@ -556,6 +556,9 @@ function parseFillLog(
|
|||
let perpMarket = perpMarkets.find((e) => e["marketIndex"] === marketIndex);
|
||||
|
||||
let lotSizes = perpLotSizes[mangoGroupPk][perpMarket.name]
|
||||
|
||||
const nativeToUi = Math.pow(10, perpMarket.baseDecimals - perpMarket.quoteDecimals);
|
||||
const lotsToNative = lotSizes.quoteLotSize / lotSizes.baseLotSize
|
||||
|
||||
const fill = {
|
||||
event_num: instructionNum,
|
||||
|
@ -563,7 +566,7 @@ function parseFillLog(
|
|||
maker_fee: new I80F48(eventData.makerFee).toNumber(),
|
||||
maker_order_id: eventData.makerOrderId.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
|
||||
quantity: eventData.quantity.toNumber() * lotSizes.baseLotSize / Math.pow(10, perpMarket.baseDecimals),
|
||||
|
|
Loading…
Reference in New Issue