In market bets tab, show limit orders' total order amount

This commit is contained in:
James Grugett 2022-07-11 11:46:07 -05:00
parent 61300e93a4
commit 90a75985dd

View File

@ -78,11 +78,19 @@ export function BetStatusText(props: {
const { bet, contract, bettor, isSelf, hideOutcome } = props
const { outcomeType } = contract
const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC'
const isFreeResponse = outcomeType === 'FREE_RESPONSE'
const { amount, outcome, createdTime } = bet
const bought = amount >= 0 ? 'bought' : 'sold'
const outOfTotalAmount =
bet.limitProb !== undefined && bet.orderAmount !== undefined
? ` / ${formatMoney(bet.orderAmount)}`
: ''
const money = formatMoney(Math.abs(amount))
const hadPoolMatch =
bet.fills?.some((fill) => fill.matchedBetId === null) ?? false
return (
<div className="text-sm text-gray-500">
{bettor ? (
@ -91,6 +99,7 @@ export function BetStatusText(props: {
<span>{isSelf ? 'You' : 'A trader'}</span>
)}{' '}
{bought} {money}
{outOfTotalAmount}
{!hideOutcome && (
<>
{' '}
@ -103,7 +112,12 @@ export function BetStatusText(props: {
/>{' '}
{isPseudoNumeric
? ' than ' + formatNumericProbability(bet.probAfter, contract)
: ' at ' + formatPercent(bet.probAfter)}
: ' at ' +
formatPercent(
hadPoolMatch || isFreeResponse
? bet.probAfter
: bet.limitProb ?? bet.probAfter
)}
</>
)}
<RelativeTimestamp time={createdTime} />