Fix initial point on graph
This commit is contained in:
parent
864b4420ad
commit
c1a800f4c6
|
@ -28,9 +28,12 @@ export function getProbability(contract: FullContract<DPM | CPMM, Binary>) {
|
||||||
export function getInitialProbability(
|
export function getInitialProbability(
|
||||||
contract: FullContract<DPM | CPMM, Binary>
|
contract: FullContract<DPM | CPMM, Binary>
|
||||||
) {
|
) {
|
||||||
return contract.initialProbability ?? contract.mechanism === 'cpmm-1'
|
return (
|
||||||
? getCpmmProbability(contract.pool)
|
contract.initialProbability ??
|
||||||
: getDpmProbability(contract.phantomShares ?? contract.totalShares)
|
(contract.mechanism === 'cpmm-1'
|
||||||
|
? getCpmmProbability(contract.pool)
|
||||||
|
: getDpmProbability(contract.phantomShares ?? contract.totalShares))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getOutcomeProbability(contract: Contract, outcome: string) {
|
export function getOutcomeProbability(contract: Contract, outcome: string) {
|
||||||
|
|
|
@ -20,12 +20,11 @@ export function ContractProbGraph(props: {
|
||||||
|
|
||||||
const startProb = getInitialProbability(contract)
|
const startProb = getInitialProbability(contract)
|
||||||
|
|
||||||
const times = bets
|
const times = [
|
||||||
? [contract.createdTime, ...bets.map((bet) => bet.createdTime)].map(
|
contract.createdTime,
|
||||||
(time) => new Date(time)
|
...bets.map((bet) => bet.createdTime),
|
||||||
)
|
].map((time) => new Date(time))
|
||||||
: []
|
const probs = [startProb, ...bets.map((bet) => bet.probAfter)]
|
||||||
const probs = bets ? [startProb, ...bets.map((bet) => bet.probAfter)] : []
|
|
||||||
|
|
||||||
const isClosed = !!closeTime && Date.now() > closeTime
|
const isClosed = !!closeTime && Date.now() > closeTime
|
||||||
const latestTime = dayjs(
|
const latestTime = dayjs(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user