Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small tweaks to the EV and Market model #36

Merged
merged 17 commits into from
Feb 14, 2024
Merged

Small tweaks to the EV and Market model #36

merged 17 commits into from
Feb 14, 2024

Conversation

kongzii
Copy link
Collaborator

@kongzii kongzii commented Feb 13, 2024

No description provided.

)

# If we don't bet, we don't have any expected returns.
if yes_shares == 0 and no_shares == 0:
Copy link
Collaborator Author

@kongzii kongzii Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes it happens the outcomes probs are 0 and 0

expected_returns_pct = (
# Assume that market starts at 50/50 and so the price is 0.5 at the time we are buying it,
# we can't use {yes,no}_outcome_price atm, because it would just cancel out to EV = 0.0,
# as it's the same as the probability.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added the comment because I confused myself in the morning 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just confused me too! 😄 Maybe could do with adding a block comment at the start of the function, like:

"""
The expected value if betting on a binary market in its initialized state of 50:50 'yes' and 'no' shares, with the assumption that the correct `p_yes` is that of the market.
"""

Can also take away the # TODO on 319, as:

  • the returned expected value is as a %, so the size of bet_units doesn't matter.
  • as you say, we can't calculate shares based on market odds if we're also using market odds as the 'correct' odds

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding a block comment

Added

Can also take away the # TODO on 319, as:

I updated it, bet size actually should make a difference, but it doesn't in our simplified calculation atm. But I would leave the comment there, so we don't forget about it.

) -> t.List[Market]:
if number > 100:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It behaves differently if closed is not set, vs. if it's false or true.

So adding it to params only if it's not none, and removing this as it can return more markets than 100.

@property
def yes_outcome_price(self) -> float:
# Use the outcome price if available, otherwise assume it's p_yes.
return self.outcomePrices[0] if self.outcomePrices else self.p_yes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ever not == self.p_yes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Polymarket returns outcomePrices, so I thought, why not use it directly? I never seen self.outcomePrices[0] != self.p_yes (as we are doing p_yes=m_json["outcomePrices"][0] in get_polymarket_markets), but I have seen self.outcomePrices[1] != (1 - p_yes), so it does make sense to differ it.

expected_returns_pct = (
# Assume that market starts at 50/50 and so the price is 0.5 at the time we are buying it,
# we can't use {yes,no}_outcome_price atm, because it would just cancel out to EV = 0.0,
# as it's the same as the probability.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just confused me too! 😄 Maybe could do with adding a block comment at the start of the function, like:

"""
The expected value if betting on a binary market in its initialized state of 50:50 'yes' and 'no' shares, with the assumption that the correct `p_yes` is that of the market.
"""

Can also take away the # TODO on 319, as:

  • the returned expected value is as a %, so the size of bet_units doesn't matter.
  • as you say, we can't calculate shares based on market odds if we're also using market odds as the 'correct' odds

Base automatically changed from peter/add-precision-and-recall to main February 14, 2024 10:11
@kongzii kongzii merged commit 360cb77 into main Feb 14, 2024
1 check passed
@kongzii kongzii deleted the peter/ev-tweaks branch February 14, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants