-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add AgentMarket.get_most_recent_trade_datetime #512
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
46c0505
Add AgentMarket.get_most_recent_trade_datetime
evangriffiths 99e2987
fix test
evangriffiths 126f5e9
Fix failing test
evangriffiths 3ab6a33
mypy
evangriffiths 06bcc9e
Review comment
evangriffiths ed9f2c9
mypy
evangriffiths 27740cb
Merge branch 'main' into evan/get_most_recent_trade_datetime
evangriffiths File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import os | ||
import time | ||
from datetime import timedelta | ||
from unittest.mock import patch | ||
|
@@ -316,24 +315,23 @@ def test_omen_buy_and_sell_outcome( | |
outcome_str = get_bet_outcome(outcome) | ||
bet_amount = market.get_bet_amount(amount=0.4) | ||
|
||
# TODO hack until https://github.com/gnosis/prediction-market-agent-tooling/issues/266 is complete | ||
os.environ[ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue has been fixed. I picked up on this as I initially added a test here, but then moved it to tests/markets/omen/test_omen.py. Will just leave this code-tidy here 😃 |
||
"BET_FROM_PRIVATE_KEY" | ||
] = test_keys.bet_from_private_key.get_secret_value() | ||
api_keys = APIKeys() | ||
|
||
def get_market_outcome_tokens() -> TokenAmount: | ||
return market.get_token_balance( | ||
user_id=api_keys.bet_from_address, | ||
user_id=test_keys.bet_from_address, | ||
outcome=outcome_str, | ||
web3=local_web3, | ||
) | ||
|
||
# Check our wallet has sufficient funds | ||
balances = get_balances(address=api_keys.bet_from_address, web3=local_web3) | ||
balances = get_balances(address=test_keys.bet_from_address, web3=local_web3) | ||
assert balances.xdai + balances.wxdai > bet_amount.amount | ||
|
||
buy_id = market.place_bet(outcome=outcome, amount=bet_amount, web3=local_web3) | ||
buy_id = market.place_bet( | ||
outcome=outcome, | ||
amount=bet_amount, | ||
web3=local_web3, | ||
api_keys=test_keys, | ||
) | ||
|
||
# Check that we now have a position in the market. | ||
outcome_tokens = get_market_outcome_tokens() | ||
|
@@ -343,7 +341,7 @@ def get_market_outcome_tokens() -> TokenAmount: | |
outcome=outcome, | ||
amount=outcome_tokens, | ||
web3=local_web3, | ||
api_keys=api_keys, | ||
api_keys=test_keys, | ||
) | ||
|
||
# Check that we have sold our entire stake in the market. | ||
|
@@ -355,7 +353,7 @@ def get_market_outcome_tokens() -> TokenAmount: | |
sell_tx = local_web3.eth.get_transaction(HexStr(sell_id)) | ||
for tx in [buy_tx, sell_tx]: | ||
assert tx is not None | ||
assert tx["from"] == api_keys.bet_from_address | ||
assert tx["from"] == test_keys.bet_from_address | ||
|
||
|
||
def test_deposit_and_withdraw_wxdai(local_web3: Web3, test_keys: APIKeys) -> None: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
another fix for a local chain test - not sure how it was passing before!