-
Notifications
You must be signed in to change notification settings - Fork 7
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
Bump to PMAT 0.9.1 and adjust bet size in KnownOutcomeAgent #50
Conversation
WalkthroughThe recent update enhances the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
return BetAmount( | ||
# On markets without liquidity, bet just a small amount for benchmarking. | ||
amount=( | ||
Decimal(0.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the liquidity check in place, maybe this could be higher?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, bump to 1.0 xDai!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumped 💪 💪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review Status
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
poetry.lock
is excluded by!**/*.lock
,!**/*.lock
pyproject.toml
is excluded by!**/*.toml
Files selected for processing (1)
- prediction_market_agent/agents/known_outcome_agent/deploy.py (2 hunks)
@@ -9,10 +9,12 @@ | |||
from prediction_market_agent_tooling.markets.agent_market import AgentMarket | |||
from prediction_market_agent_tooling.markets.data_models import BetAmount, Currency | |||
from prediction_market_agent_tooling.markets.markets import MarketType | |||
from prediction_market_agent_tooling.markets.omen.omen import OmenAgentMarket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider grouping imports from the same module together to improve readability.
- from prediction_market_agent_tooling.markets.markets import MarketType
- from prediction_market_agent_tooling.markets.omen.omen import OmenAgentMarket
+ from prediction_market_agent_tooling.markets.markets import MarketType
+ from prediction_market_agent_tooling.markets.omen import OmenAgentMarket
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
from prediction_market_agent_tooling.markets.omen.omen import OmenAgentMarket | |
from prediction_market_agent_tooling.markets.markets import MarketType | |
from prediction_market_agent_tooling.markets.omen import OmenAgentMarket |
if isinstance(market, OmenAgentMarket): | ||
if market.currency != Currency.xDai: | ||
should_not_happen() | ||
return BetAmount( | ||
# On markets without liquidity, bet just a small amount for benchmarking. | ||
amount=( | ||
Decimal(0.1) | ||
if market.get_liquidity_in_xdai() > 5 | ||
else market.get_tiny_bet_amount().amount | ||
), | ||
currency=Currency.xDai, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure proper error handling for the should_not_happen()
call in the calculate_bet_amount
method.
if market.currency != Currency.xDai:
- should_not_happen()
+ raise ValueError("Unsupported currency for OmenAgentMarket")
This change replaces a generic error function with a more descriptive exception, improving maintainability and debuggability.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if isinstance(market, OmenAgentMarket): | |
if market.currency != Currency.xDai: | |
should_not_happen() | |
return BetAmount( | |
# On markets without liquidity, bet just a small amount for benchmarking. | |
amount=( | |
Decimal(0.1) | |
if market.get_liquidity_in_xdai() > 5 | |
else market.get_tiny_bet_amount().amount | |
), | |
currency=Currency.xDai, | |
) | |
if isinstance(market, OmenAgentMarket): | |
if market.currency != Currency.xDai: | |
raise ValueError("Unsupported currency for OmenAgentMarket") | |
return BetAmount( | |
# On markets without liquidity, bet just a small amount for benchmarking. | |
amount=( | |
Decimal(0.1) | |
if market.get_liquidity_in_xdai() > 5 | |
else market.get_tiny_bet_amount().amount | |
), | |
currency=Currency.xDai, | |
) |
Refactor the calculate_bet_amount
method to simplify the conditional logic for determining the bet amount.
if isinstance(market, OmenAgentMarket):
if market.currency != Currency.xDai:
raise ValueError("Unsupported currency for OmenAgentMarket")
+ liquidity_threshold = Decimal(5)
+ tiny_bet_amount = market.get_tiny_bet_amount().amount
+ bet_amount = Decimal(0.1) if market.get_liquidity_in_xdai() > liquidity_threshold else tiny_bet_amount
- return BetAmount(
- amount=(
- Decimal(0.1)
- if market.get_liquidity_in_xdai() > 5
- else market.get_tiny_bet_amount().amount
- ),
- currency=Currency.xDai,
- )
+ return BetAmount(amount=bet_amount, currency=Currency.xDai)
This refactor simplifies the logic for determining the bet amount and makes the code more readable by reducing nesting and using descriptive variable names.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if isinstance(market, OmenAgentMarket): | |
if market.currency != Currency.xDai: | |
should_not_happen() | |
return BetAmount( | |
# On markets without liquidity, bet just a small amount for benchmarking. | |
amount=( | |
Decimal(0.1) | |
if market.get_liquidity_in_xdai() > 5 | |
else market.get_tiny_bet_amount().amount | |
), | |
currency=Currency.xDai, | |
) | |
if isinstance(market, OmenAgentMarket): | |
if market.currency != Currency.xDai: | |
raise ValueError("Unsupported currency for OmenAgentMarket") | |
liquidity_threshold = Decimal(5) | |
tiny_bet_amount = market.get_tiny_bet_amount().amount | |
bet_amount = Decimal(0.1) if market.get_liquidity_in_xdai() > liquidity_threshold else tiny_bet_amount | |
return BetAmount(amount=bet_amount, currency=Currency.xDai) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- prediction_market_agent/agents/known_outcome_agent/deploy.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- prediction_market_agent/agents/known_outcome_agent/deploy.py
Summary by CodeRabbit