Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
calculateTradingFees: function (makerFee, takerFee) {
var bnMakerFee, tradingFee, makerProportionOfFee;
bnMakerFee = abi.bignum(makerFee);
tradingFee = abi.bignum(takerFee).plus(bnMakerFee).dividedBy(ONE_POINT_FIVE);
makerProportionOfFee = bnMakerFee.dividedBy(tradingFee);
return {tradingFee: tradingFee, makerProportionOfFee: makerProportionOfFee};
},
expandScalarPrice: function (minValue, price) {
if (minValue.constructor !== BigNumber) minValue = abi.bignum(minValue);
if (price.constructor !== BigNumber) price = abi.bignum(price);
return price.plus(minValue).toFixed();
},
shrinkScalarPrice: function (minValue, price) {
if (minValue.constructor !== BigNumber) minValue = abi.bignum(minValue);
if (price.constructor !== BigNumber) price = abi.bignum(price);
return price.minus(minValue).toFixed();
},
}, function (sharesPurchased) {
bnSharesPurchased = abi.bignum(sharesPurchased);
api().Cash.balance({ address: address }, function (cashBalance) {
bnCashBalance = abi.bignum(cashBalance);
nextTrade();
});
});
},
calculateFxpMakerTakerFees: function (tradingFee, makerProportionOfFee) {
var fxpTradingFee, fxpMakerProportionOfFee, makerFee, takerFee;
fxpTradingFee = abi.bignum(tradingFee);
fxpMakerProportionOfFee = abi.bignum(makerProportionOfFee);
makerFee = fxpTradingFee.times(fxpMakerProportionOfFee).dividedBy(constants.ONE).floor();
takerFee = ONE_POINT_FIVE.times(fxpTradingFee).dividedBy(constants.ONE).floor().minus(makerFee);
return {
trading: fxpTradingFee,
maker: makerFee,
taker: takerFee
};
},