-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trades return ID, matches with ID returned from AgentMarket.get_bets_…
…made_since (#434)
- Loading branch information
1 parent
9e20d4e
commit 53a85c9
Showing
13 changed files
with
900 additions
and
789 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import time | ||
|
||
import pytest | ||
|
||
from prediction_market_agent_tooling.config import APIKeys | ||
from prediction_market_agent_tooling.markets.agent_market import FilterBy, SortBy | ||
from prediction_market_agent_tooling.markets.omen.omen import OmenAgentMarket | ||
from prediction_market_agent_tooling.tools.utils import utcnow | ||
from tests.utils import RUN_PAID_TESTS | ||
|
||
|
||
@pytest.mark.skipif(not RUN_PAID_TESTS, reason="This test costs money to run.") | ||
def test_match_bet_ids_with_get_subgraph_bets() -> None: | ||
market = OmenAgentMarket.get_binary_markets( | ||
limit=1, | ||
sort_by=SortBy.CLOSING_SOONEST, | ||
filter_by=FilterBy.OPEN, | ||
)[0] | ||
now = utcnow() | ||
id0 = market.buy_tokens(outcome=True, amount=market.get_tiny_bet_amount()) | ||
id1 = market.buy_tokens(outcome=True, amount=market.get_tiny_bet_amount()) | ||
assert id0 != id1 | ||
|
||
time.sleep(10) # wait for the subgraph to index the bets | ||
keys = APIKeys() | ||
bets = OmenAgentMarket.get_bets_made_since( | ||
better_address=keys.bet_from_address, | ||
start_time=now, | ||
) | ||
# Ensure bets are sorted by ascending time | ||
bets = sorted(bets, key=lambda bet: bet.created_time) | ||
assert len(bets) == 2 | ||
assert bets[0].id == id0 | ||
assert bets[1].id == id1 |
Oops, something went wrong.