fix formula
This commit is contained in:
parent
22a40a822e
commit
c1d284ec6b
|
@ -155,8 +155,6 @@ const AdvancedTradeForm = () => {
|
|||
return bank
|
||||
}, [selectedMarket])
|
||||
|
||||
console.log(selectedMarket)
|
||||
|
||||
// check for available account token slots
|
||||
const tokenPositionsFull = useTokenPositionsFull([baseBank, quoteBank])
|
||||
|
||||
|
@ -545,11 +543,27 @@ const AdvancedTradeForm = () => {
|
|||
}
|
||||
if (selectedMarket instanceof Serum3Market && price) {
|
||||
const numberPrice = parseFloat(price)
|
||||
const priceDiff = (numberPrice - oraclePrice) / oraclePrice
|
||||
if (Math.abs(priceDiff) > selectedMarket.oraclePriceBand) {
|
||||
invalidFields.price = t('trade:error-limit-price-outside-band', {
|
||||
band: (selectedMarket.oraclePriceBand * 100).toFixed(2),
|
||||
})
|
||||
const priceBand = selectedMarket.oraclePriceBand
|
||||
if (side === 'buy') {
|
||||
const priceLimit = (oraclePrice / (100 * (0.98 + priceBand))) * 100
|
||||
if (numberPrice < priceLimit) {
|
||||
invalidFields.price = t(
|
||||
'trade:error-limit-price-buy-outside-band',
|
||||
{
|
||||
limit: priceLimit.toFixed(tickDecimals),
|
||||
},
|
||||
)
|
||||
}
|
||||
} else {
|
||||
const priceLimit = (oraclePrice / (100 / (0.98 + priceBand))) * 100
|
||||
if (numberPrice > priceLimit) {
|
||||
invalidFields.price = t(
|
||||
'trade:error-limit-price-sell-outside-band',
|
||||
{
|
||||
limit: priceLimit.toFixed(tickDecimals),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Object.keys(invalidFields).length) {
|
||||
|
@ -567,6 +581,7 @@ const AdvancedTradeForm = () => {
|
|||
setFormErrors,
|
||||
baseSymbol,
|
||||
t,
|
||||
tickDecimals,
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
"current-price": "Current Price",
|
||||
"depth": "Depth",
|
||||
"edit-order": "Edit Order",
|
||||
"error-limit-price-outside-band": "Limit price must be within {{band}}% of oracle price",
|
||||
"error-limit-price-buy-outside-band": "Limit price must be above {{limit}}",
|
||||
"error-limit-price-sell-outside-band": "Limit price must be below {{limit}}",
|
||||
"error-no-long": "No long position to reduce",
|
||||
"error-no-route": "No route found. Try adjusting your size",
|
||||
"error-no-short": "No borrow position to reduce",
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
"current-price": "Current Price",
|
||||
"depth": "Depth",
|
||||
"edit-order": "Edit Order",
|
||||
"error-limit-price-outside-band": "Limit price must be within {{band}}% of oracle price",
|
||||
"error-limit-price-buy-outside-band": "Limit price must be above {{limit}}",
|
||||
"error-limit-price-sell-outside-band": "Limit price must be below {{limit}}",
|
||||
"error-no-long": "No long position to reduce",
|
||||
"error-no-route": "No route found. Try adjusting your size",
|
||||
"error-no-short": "No borrow position to reduce",
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
"current-price": "Current Price",
|
||||
"depth": "Depth",
|
||||
"edit-order": "Edit Order",
|
||||
"error-limit-price-outside-band": "Limit price must be within {{band}}% of oracle price",
|
||||
"error-limit-price-buy-outside-band": "Limit price must be above {{limit}}",
|
||||
"error-limit-price-sell-outside-band": "Limit price must be below {{limit}}",
|
||||
"error-no-long": "No long position to reduce",
|
||||
"error-no-route": "No route found. Try adjusting your size",
|
||||
"error-no-short": "No borrow position to reduce",
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
"current-price": "目前价格",
|
||||
"depth": "深度",
|
||||
"edit-order": "编辑订单",
|
||||
"error-limit-price-outside-band": "Limit price must be within {{band}}% of oracle price",
|
||||
"error-limit-price-buy-outside-band": "Limit price must be above {{limit}}",
|
||||
"error-limit-price-sell-outside-band": "Limit price must be below {{limit}}",
|
||||
"error-no-long": "无做多持仓可减少",
|
||||
"error-no-route": "No route found. Try adjusting your size",
|
||||
"error-no-short": "无做空持仓可减少",
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
"current-price": "目前價格",
|
||||
"depth": "深度",
|
||||
"edit-order": "編輯訂單",
|
||||
"error-limit-price-outside-band": "Limit price must be within {{band}}% of oracle price",
|
||||
"error-limit-price-buy-outside-band": "Limit price must be above {{limit}}",
|
||||
"error-limit-price-sell-outside-band": "Limit price must be below {{limit}}",
|
||||
"error-no-long": "無做多持倉可減少",
|
||||
"error-no-route": "No route found. Try adjusting your size",
|
||||
"error-no-short": "無做空持倉可減少",
|
||||
|
|
Loading…
Reference in New Issue