fixed maxQuoteQuantity bug

This commit is contained in:
dd 2021-03-01 17:49:24 -05:00
parent 664d4f70cd
commit 22a313e02b
1 changed files with 3 additions and 3 deletions

View File

@ -842,9 +842,9 @@ export class MangoClient {
const feeTier = getFeeTier(0, nativeToUi(mangoGroup.nativeSrm || 0, SRM_DECIMALS)); const feeTier = getFeeTier(0, nativeToUi(mangoGroup.nativeSrm || 0, SRM_DECIMALS));
const rates = getFeeRates(feeTier); const rates = getFeeRates(feeTier);
const maxQuoteQuantity = new BN(spotMarket['_decoded'].quoteLotSize.toNumber() * rates.taker).mul( const maxQuoteQuantity = new BN(
spotMarket.baseSizeNumberToLots(size).mul(spotMarket.priceNumberToLots(price)), spotMarket['_decoded'].quoteLotSize.toNumber() * (1 + rates.taker),
); ).mul(spotMarket.baseSizeNumberToLots(size).mul(spotMarket.priceNumberToLots(price)));
if (maxBaseQuantity.lte(new BN(0))) { if (maxBaseQuantity.lte(new BN(0))) {
throw new Error('size too small') throw new Error('size too small')