base precision correction for spot filler
This commit is contained in:
@@ -111,6 +111,10 @@ const main = async () => {
|
|||||||
JSON.stringify(event.action) === JSON.stringify(OrderAction.FILL)
|
JSON.stringify(event.action) === JSON.stringify(OrderAction.FILL)
|
||||||
),
|
),
|
||||||
map((fill: Event<OrderActionRecord>) => {
|
map((fill: Event<OrderActionRecord>) => {
|
||||||
|
const basePrecision =
|
||||||
|
getVariant(fill.marketType) === 'spot'
|
||||||
|
? sdkConfig.SPOT_MARKETS[fill.marketIndex].precision
|
||||||
|
: BASE_PRECISION;
|
||||||
return {
|
return {
|
||||||
ts: fill.ts.toNumber(),
|
ts: fill.ts.toNumber(),
|
||||||
marketIndex: fill.marketIndex,
|
marketIndex: fill.marketIndex,
|
||||||
@@ -124,7 +128,7 @@ const main = async () => {
|
|||||||
),
|
),
|
||||||
baseAssetAmountFilled: convertToNumber(
|
baseAssetAmountFilled: convertToNumber(
|
||||||
fill.baseAssetAmountFilled,
|
fill.baseAssetAmountFilled,
|
||||||
BASE_PRECISION
|
basePrecision
|
||||||
),
|
),
|
||||||
quoteAssetAmountFilled: convertToNumber(
|
quoteAssetAmountFilled: convertToNumber(
|
||||||
fill.quoteAssetAmountFilled,
|
fill.quoteAssetAmountFilled,
|
||||||
@@ -137,11 +141,11 @@ const main = async () => {
|
|||||||
: undefined,
|
: undefined,
|
||||||
takerOrderBaseAssetAmount: convertToNumber(
|
takerOrderBaseAssetAmount: convertToNumber(
|
||||||
fill.takerOrderBaseAssetAmount,
|
fill.takerOrderBaseAssetAmount,
|
||||||
BASE_PRECISION
|
basePrecision
|
||||||
),
|
),
|
||||||
takerOrderCumulativeBaseAssetAmountFilled: convertToNumber(
|
takerOrderCumulativeBaseAssetAmountFilled: convertToNumber(
|
||||||
fill.takerOrderCumulativeBaseAssetAmountFilled,
|
fill.takerOrderCumulativeBaseAssetAmountFilled,
|
||||||
BASE_PRECISION
|
basePrecision
|
||||||
),
|
),
|
||||||
takerOrderCumulativeQuoteAssetAmountFilled: convertToNumber(
|
takerOrderCumulativeQuoteAssetAmountFilled: convertToNumber(
|
||||||
fill.takerOrderCumulativeQuoteAssetAmountFilled,
|
fill.takerOrderCumulativeQuoteAssetAmountFilled,
|
||||||
@@ -154,11 +158,11 @@ const main = async () => {
|
|||||||
: undefined,
|
: undefined,
|
||||||
makerOrderBaseAssetAmount: convertToNumber(
|
makerOrderBaseAssetAmount: convertToNumber(
|
||||||
fill.makerOrderBaseAssetAmount,
|
fill.makerOrderBaseAssetAmount,
|
||||||
BASE_PRECISION
|
basePrecision
|
||||||
),
|
),
|
||||||
makerOrderCumulativeBaseAssetAmountFilled: convertToNumber(
|
makerOrderCumulativeBaseAssetAmountFilled: convertToNumber(
|
||||||
fill.makerOrderCumulativeBaseAssetAmountFilled,
|
fill.makerOrderCumulativeBaseAssetAmountFilled,
|
||||||
BASE_PRECISION
|
basePrecision
|
||||||
),
|
),
|
||||||
makerOrderCumulativeQuoteAssetAmountFilled: convertToNumber(
|
makerOrderCumulativeQuoteAssetAmountFilled: convertToNumber(
|
||||||
fill.makerOrderCumulativeQuoteAssetAmountFilled,
|
fill.makerOrderCumulativeQuoteAssetAmountFilled,
|
||||||
|
|||||||
Reference in New Issue
Block a user