Skip to content

Commit

Permalink
ui: Fix maxOrder when not enough balance
Browse files Browse the repository at this point in the history
With zero max lots, fix lots undefined.
  • Loading branch information
vctt94 committed Jul 31, 2021
1 parent 3ea9141 commit f118992
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/webserver/site/src/js/markets.js
Expand Up @@ -677,6 +677,8 @@ export default class MarketsPage extends BasePage {
const quoteAsset = app.assets[order.quote]
const total = Doc.formatCoinValue(order.rate / 1e8 * order.qty / 1e8)
page.orderPreview.textContent = `Total: ${total} ${quoteAsset.symbol.toUpperCase()}`
if (this.isSell()) this.preSell()
else this.preBuy()
}

/**
Expand All @@ -686,7 +688,7 @@ export default class MarketsPage extends BasePage {
const mkt = this.market
const baseWallet = app.assets[mkt.base.id].wallet
if (baseWallet.available < mkt.cfg.lotsize) {
this.setMaxOrder(0, this.adjustedRate() / 1e8)
this.setMaxOrder({ lots: 0 }, this.adjustedRate() / 1e8)
return
}
if (mkt.maxSell) {
Expand All @@ -710,7 +712,7 @@ export default class MarketsPage extends BasePage {
const quoteWallet = app.assets[mkt.quote.id].wallet
const aLot = mkt.cfg.lotsize * (rate / 1e8)
if (quoteWallet.balance.available < aLot) {
this.setMaxOrder(0, 1e8 / rate)
this.setMaxOrder({ lots: 0 }, 1e8 / rate)
return
}
if (mkt.maxBuys[rate]) {
Expand Down

0 comments on commit f118992

Please sign in to comment.