Update sort order of limit orders (older bets first b/c they are filled first)
This commit is contained in:
parent
97b38c156f
commit
645cfc65f4
|
@ -22,20 +22,20 @@ export function LimitBets(props: {
|
||||||
className?: string
|
className?: string
|
||||||
}) {
|
}) {
|
||||||
const { contract, bets, className } = props
|
const { contract, bets, className } = props
|
||||||
const sortedBets = sortBy(
|
|
||||||
bets,
|
|
||||||
(bet) => -1 * bet.limitProb,
|
|
||||||
(bet) => -1 * bet.createdTime
|
|
||||||
)
|
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const yourBets = sortedBets.filter((bet) => bet.userId === user?.id)
|
|
||||||
|
const yourBets = sortBy(
|
||||||
|
bets.filter((bet) => bet.userId === user?.id),
|
||||||
|
(bet) => -1 * bet.limitProb,
|
||||||
|
(bet) => bet.createdTime
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className={className}>
|
<Col className={className}>
|
||||||
{yourBets.length === 0 && (
|
{yourBets.length === 0 && (
|
||||||
<OrderBookButton
|
<OrderBookButton
|
||||||
className="self-end"
|
className="self-end"
|
||||||
limitBets={sortedBets}
|
limitBets={bets}
|
||||||
contract={contract}
|
contract={contract}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -49,7 +49,7 @@ export function LimitBets(props: {
|
||||||
|
|
||||||
<OrderBookButton
|
<OrderBookButton
|
||||||
className="self-end"
|
className="self-end"
|
||||||
limitBets={sortedBets}
|
limitBets={bets}
|
||||||
contract={contract}
|
contract={contract}
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -163,8 +163,16 @@ export function OrderBookButton(props: {
|
||||||
const { limitBets, contract, className } = props
|
const { limitBets, contract, className } = props
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
const yesBets = limitBets.filter((bet) => bet.outcome === 'YES')
|
const yesBets = sortBy(
|
||||||
const noBets = limitBets.filter((bet) => bet.outcome === 'NO').reverse()
|
limitBets.filter((bet) => bet.outcome === 'YES'),
|
||||||
|
(bet) => -1 * bet.limitProb,
|
||||||
|
(bet) => bet.createdTime
|
||||||
|
)
|
||||||
|
const noBets = sortBy(
|
||||||
|
limitBets.filter((bet) => bet.outcome === 'NO'),
|
||||||
|
(bet) => bet.limitProb,
|
||||||
|
(bet) => bet.createdTime
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user