Dynamically choose outcome in Position tooltip (#1048)
This commit is contained in:
parent
58cd0e57bd
commit
4097082c75
|
@ -25,10 +25,8 @@ export function BetsSummary(props: {
|
||||||
const isBinary = outcomeType === 'BINARY'
|
const isBinary = outcomeType === 'BINARY'
|
||||||
|
|
||||||
const bets = props.userBets.filter((b) => !b.isAnte)
|
const bets = props.userBets.filter((b) => !b.isAnte)
|
||||||
const { profitPercent, payout, profit, invested } = getContractBetMetrics(
|
const { profitPercent, payout, profit, invested, hasShares } =
|
||||||
contract,
|
getContractBetMetrics(contract, bets)
|
||||||
bets
|
|
||||||
)
|
|
||||||
|
|
||||||
const excludeSales = bets.filter((b) => !b.isSold && !b.sale)
|
const excludeSales = bets.filter((b) => !b.isSold && !b.sale)
|
||||||
const yesWinnings = sumBy(excludeSales, (bet) =>
|
const yesWinnings = sumBy(excludeSales, (bet) =>
|
||||||
|
@ -39,6 +37,7 @@ export function BetsSummary(props: {
|
||||||
)
|
)
|
||||||
|
|
||||||
const position = yesWinnings - noWinnings
|
const position = yesWinnings - noWinnings
|
||||||
|
const outcome = hasShares ? (position > 0 ? 'YES' : 'NO') : undefined
|
||||||
|
|
||||||
const prob = isBinary ? getProbability(contract) : 0
|
const prob = isBinary ? getProbability(contract) : 0
|
||||||
const expectation = prob * yesWinnings + (1 - prob) * noWinnings
|
const expectation = prob * yesWinnings + (1 - prob) * noWinnings
|
||||||
|
@ -60,7 +59,9 @@ export function BetsSummary(props: {
|
||||||
<Col>
|
<Col>
|
||||||
<div className="whitespace-nowrap text-sm text-gray-500">
|
<div className="whitespace-nowrap text-sm text-gray-500">
|
||||||
Position{' '}
|
Position{' '}
|
||||||
<InfoTooltip text="Number of shares you own on net. 1 YES share = M$1 if the market resolves YES." />
|
<InfoTooltip
|
||||||
|
text={`Number of shares you own on net. 1 ${outcome} share = M$1 if the market resolves ${outcome}.`}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="whitespace-nowrap">
|
<div className="whitespace-nowrap">
|
||||||
{position > 1e-7 ? (
|
{position > 1e-7 ? (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user