-
Notifications
You must be signed in to change notification settings - Fork 2
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
Gabriel/resolved bets in agent market #300
Conversation
This reverts commit aa445c4.
Important Review skippedReview was skipped due to path filters Files ignored due to path filters (1)
You can disable this status message by setting the WalkthroughThe changes primarily focus on adding new functionalities for resolving bets in the Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant AgentMarket
participant DataModels
participant ManifoldAPI
participant OmenDataModels
participant Omen
User ->> AgentMarket: Call get_resolved_bets_made_since()
AgentMarket ->> Omen: Forward get_resolved_bets_made_since()
Omen ->> OmenDataModels: Retrieve Resolved Bets
OmenDataModels ->> Omen: Return List of ResolvedBets
Omen ->> AgentMarket: Return List of ResolvedBets
AgentMarket ->> User: Return List of ResolvedBets
Possibly related issues
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 (
|
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: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (3)
poetry.lock
is excluded by!**/*.lock
,!**/*.lock
pyproject.toml
is excluded by!**/*.toml
scripts/example_tool_metadata.json
is excluded by!**/*.json
Files selected for processing (5)
- prediction_market_agent_tooling/markets/agent_market.py (2 hunks)
- prediction_market_agent_tooling/markets/data_models.py (5 hunks)
- prediction_market_agent_tooling/markets/manifold/api.py (2 hunks)
- prediction_market_agent_tooling/markets/omen/data_models.py (2 hunks)
- prediction_market_agent_tooling/markets/omen/omen.py (2 hunks)
Additional context used
Learnings (1)
prediction_market_agent_tooling/markets/agent_market.py (1)
Learnt from: kongzii PR: gnosis/prediction-market-agent-tooling#224 File: prediction_market_agent_tooling/markets/markets.py:67-67 Timestamp: 2024-04-29T14:14:38.751Z Learning: The function `have_bet_on_market_since` is suggested to be refactored into a method on the `AgentMarket` class, potentially reusing code from `DeployedAgent.get_resolved_bets`. This task is planned for future work, not within the scope of the current PR.
Additional comments not posted (9)
prediction_market_agent_tooling/markets/data_models.py (4)
16-17
: Correct Implementation of__str__
Method.The
__str__
method correctly returns the string representation of theCurrency
enum.
31-32
: Correct Implementation of__str__
Method.The
__str__
method correctly returns a formatted string representation of theTokenAmount
instance.
44-47
: Correct Implementation ofmarket_id
Field and__str__
Method.The
market_id
field and the__str__
method are correctly implemented. The method provides a clear string representation of theBet
instance.
60-61
: Correct Implementation of__str__
Method.The
__str__
method correctly returns a detailed string representation of theResolvedBet
instance.prediction_market_agent_tooling/markets/manifold/api.py (1)
216-216
: Correct Update tomanifold_to_generic_resolved_bet
Function.The
market_id
parameter with aHexAddress
value derived fromHexStr(market.id)
is correctly included in themanifold_to_generic_resolved_bet
function.prediction_market_agent_tooling/markets/agent_market.py (1)
167-171
: Reminder: Implement theget_resolved_bets_made_since
Method.The
get_resolved_bets_made_since
method raises aNotImplementedError
. Ensure this method is implemented in subclasses.Do you want me to generate the implementation for this method or open a GitHub issue to track this task?
prediction_market_agent_tooling/markets/omen/data_models.py (2)
389-389
: Correct Update toto_bet
Method.The
market_id
field is correctly included in theto_bet
method.
403-403
: Correct Update toto_generic_resolved_bet
Method.The
market_id
andmarket_outcome
fields are correctly included in theto_generic_resolved_bet
method.prediction_market_agent_tooling/markets/omen/omen.py (1)
340-343
: Ensure proper error handling for external calls.The function
get_resolved_bets_made_since
relies on theOmenSubgraphHandler
to fetch data. Ensure that potential errors from this external call are properly handled.
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 details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- prediction_market_agent_tooling/markets/data_models.py (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- prediction_market_agent_tooling/markets/data_models.py
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 details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- prediction_market_agent_tooling/markets/agent_market.py (2 hunks)
- prediction_market_agent_tooling/markets/manifold/api.py (2 hunks)
- prediction_market_agent_tooling/markets/omen/omen.py (2 hunks)
Files skipped from review as they are similar to previous changes (3)
- prediction_market_agent_tooling/markets/agent_market.py
- prediction_market_agent_tooling/markets/manifold/api.py
- prediction_market_agent_tooling/markets/omen/omen.py
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 details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- prediction_market_agent_tooling/markets/agent_market.py (2 hunks)
- prediction_market_agent_tooling/markets/omen/omen.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- prediction_market_agent_tooling/markets/omen/omen.py
Additional context used
Learnings (1)
prediction_market_agent_tooling/markets/agent_market.py (1)
Learnt from: evangriffiths PR: gnosis/prediction-market-agent-tooling#300 File: prediction_market_agent_tooling/markets/omen/omen.py:344-352 Timestamp: 2024-07-08T07:05:58.507Z Learning: The `get_resolved_bets_made_since` method in the `OmenAgentMarket` class should include an `end_time` argument to make it more flexible.
Additional comments not posted (2)
prediction_market_agent_tooling/markets/agent_market.py (2)
167-171
: Confirm the correct method signature.The method signature includes the
end_time
argument, which makes it more flexible. This aligns with the learning retrieved from long-term memory.
171-171
: Implement the method functionality.The method currently raises a
NotImplementedError
. Ensure that the functionality is implemented in subclasses.
Co-authored-by: Peter Jung <[email protected]>
Co-authored-by: Peter Jung <[email protected]>
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: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- prediction_market_agent_tooling/markets/data_models.py (3 hunks)
- prediction_market_agent_tooling/markets/manifold/api.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- prediction_market_agent_tooling/markets/manifold/api.py
Additional comments not posted (3)
prediction_market_agent_tooling/markets/data_models.py (3)
27-28
: Consider using f-strings for consistency.The
__str__
method uses f-strings, which is consistent with modern Python practices.
42-43
: Consider using f-strings for consistency.The
__str__
method uses f-strings, which is consistent with modern Python practices.
56-57
: Consider using f-strings for consistency.The
__str__
method uses f-strings, which is consistent with modern Python practices.
@@ -34,6 +37,10 @@ class Bet(BaseModel): | |||
outcome: bool | |||
created_time: datetime | |||
market_question: str | |||
market_id: str |
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.
Tip
Codebase Verification
Ensure market_id
is correctly populated.
The new market_id
field should be correctly populated wherever Bet
and ResolvedBet
instances are created. The following instances do not populate market_id
:
prediction_market_agent_tooling/markets/omen/data_models.py
- Line: 40
- Line: 49
prediction_market_agent_tooling/markets/manifold/api.py
- Line: 40
Please update these instances to include the market_id
field.
Analysis chain
Ensure market_id
is correctly populated.
The new market_id
field should be correctly populated wherever Bet
instances are created.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that `market_id` is correctly populated in all instances of the `Bet` class.
# Test: Search for the creation of `Bet` instances. Expect: All instances should correctly populate `market_id`.
rg --type python $'Bet('
Length of output: 84
Script:
#!/bin/bash
# Description: Verify that `market_id` is correctly populated in all instances of the `Bet` class.
# Test: Search for the creation of `Bet` instances. Expect: All instances should correctly populate `market_id`.
rg --type python 'Bet\('
Length of output: 57
Script:
#!/bin/bash
# Description: Verify that `market_id` is correctly populated in all instances of the `Bet` class.
# Test: Search for the creation of `Bet` instances. Expect: All instances should correctly populate `market_id`.
rg -t py 'Bet\('
Length of output: 602
Script:
#!/bin/bash
# Description: Verify that `market_id` is correctly populated in all instances of the `Bet` class and its subclasses.
# Search for the instantiation of Bet and ResolvedBet in the identified files.
rg -A 3 -B 3 'Bet\(' prediction_market_agent_tooling/markets/omen/data_models.py
rg -A 3 -B 3 'ResolvedBet\(' prediction_market_agent_tooling/markets/omen/data_models.py
rg -A 3 -B 3 'ResolvedBet\(' prediction_market_agent_tooling/markets/manifold/api.py
Length of output: 1556
…resolved-bets-in-agent-market # Conflicts: # pyproject.toml
See PR comments here
https://github.com/gnosis/prediction-market-agent/pull/306/files#r1664311729