diff --git a/packages/server/src/trade/trade-ask.service.ts b/packages/server/src/trade/trade-ask.service.ts index 4235229f..e3a50040 100644 --- a/packages/server/src/trade/trade-ask.service.ts +++ b/packages/server/src/trade/trade-ask.service.ts @@ -44,7 +44,7 @@ export class AskService implements OnModuleInit { } }) if(!asset) return 0; - return asset.quantity * (percent / 100); + return parseFloat((asset.quantity * (percent / 100)).toFixed(8)); } async createAskTrade(user, askDto) { if(askDto.receivedAmount * askDto.receivedPrice < 5000) throw new BadRequestException(); diff --git a/packages/server/src/trade/trade-bid.service.ts b/packages/server/src/trade/trade-bid.service.ts index e5a3d14d..fc2cad2d 100644 --- a/packages/server/src/trade/trade-bid.service.ts +++ b/packages/server/src/trade/trade-bid.service.ts @@ -37,7 +37,7 @@ export class BidService implements OnModuleInit { async calculatePercentBuy(user, moneyType: string, percent: number) { const money = await this.accountRepository.getMyMoney(user, moneyType); - return Number(money) * (percent / 100); + return parseFloat((money * (percent / 100)).toFixed(8)); } async createBidTrade(user, bidDto) { if(bidDto.receivedAmount * bidDto.receivedPrice < 5000) throw new BadRequestException();