prediction-market-agent-tooling 0.61.1.dev485__py3-none-any.whl → 0.61.1.dev487__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prediction_market_agent_tooling/markets/seer/price_manager.py +9 -11
- prediction_market_agent_tooling/markets/seer/seer.py +11 -4
- prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py +1 -1
- {prediction_market_agent_tooling-0.61.1.dev485.dist-info → prediction_market_agent_tooling-0.61.1.dev487.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.61.1.dev485.dist-info → prediction_market_agent_tooling-0.61.1.dev487.dist-info}/RECORD +8 -8
- {prediction_market_agent_tooling-0.61.1.dev485.dist-info → prediction_market_agent_tooling-0.61.1.dev487.dist-info}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.61.1.dev485.dist-info → prediction_market_agent_tooling-0.61.1.dev487.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.61.1.dev485.dist-info → prediction_market_agent_tooling-0.61.1.dev487.dist-info}/entry_points.txt +0 -0
@@ -11,9 +11,6 @@ from prediction_market_agent_tooling.markets.seer.seer_subgraph_handler import (
|
|
11
11
|
SeerSubgraphHandler,
|
12
12
|
)
|
13
13
|
from prediction_market_agent_tooling.markets.seer.subgraph_data_models import SeerPool
|
14
|
-
from prediction_market_agent_tooling.tools.caches.inmemory_cache import (
|
15
|
-
persistent_inmemory_cache,
|
16
|
-
)
|
17
14
|
from prediction_market_agent_tooling.tools.cow.cow_manager import CowManager
|
18
15
|
from prediction_market_agent_tooling.tools.web3_utils import xdai_to_wei
|
19
16
|
|
@@ -23,7 +20,6 @@ class PriceManager:
|
|
23
20
|
self.seer_market = seer_market
|
24
21
|
self.seer_subgraph = seer_subgraph
|
25
22
|
|
26
|
-
@property
|
27
23
|
def current_p_yes(self) -> Probability:
|
28
24
|
price_data = {}
|
29
25
|
for idx, wrapped_token in enumerate(self.seer_market.wrapped_tokens):
|
@@ -52,7 +48,6 @@ class PriceManager:
|
|
52
48
|
price_yes = price_yes / sum(price_data.values())
|
53
49
|
return Probability(price_yes)
|
54
50
|
|
55
|
-
@persistent_inmemory_cache
|
56
51
|
def get_price_for_token(
|
57
52
|
self,
|
58
53
|
token: ChecksumAddress,
|
@@ -88,23 +83,26 @@ class PriceManager:
|
|
88
83
|
return 0
|
89
84
|
# Check if other token is market's collateral (sanity check).
|
90
85
|
|
91
|
-
|
86
|
+
# Collateral is the other token in the pair
|
87
|
+
collateral_address = Web3.to_checksum_address(
|
92
88
|
pool.token0.id
|
93
|
-
if self._pool_token0_matches_token(token=token, pool=pool)
|
89
|
+
if not self._pool_token0_matches_token(token=token, pool=pool)
|
94
90
|
else pool.token1.id
|
95
91
|
)
|
96
92
|
if (
|
97
|
-
collateral_address
|
98
|
-
!= self.seer_market.collateral_token_contract_address_checksummed
|
93
|
+
collateral_address
|
94
|
+
!= self.seer_market.collateral_token_contract_address_checksummed
|
99
95
|
):
|
100
96
|
logger.warning(
|
101
97
|
f"Pool {pool.id.hex()} has collateral mismatch with market. Collateral from pool {collateral_address.hex()}, collateral from market {self.seer_market.collateral_token_contract_address_checksummed}, returning 0."
|
102
98
|
)
|
103
99
|
return 0
|
104
100
|
|
101
|
+
# The mapping below is odd but surprisingly the Algebra subgraph delivers the token1Price
|
102
|
+
# for the token0 and the token0Price for the token1 pool.
|
105
103
|
price_in_collateral_units = (
|
106
|
-
pool.
|
104
|
+
pool.token1Price
|
107
105
|
if self._pool_token0_matches_token(token=token, pool=pool)
|
108
|
-
else pool.
|
106
|
+
else pool.token0Price
|
109
107
|
)
|
110
108
|
return price_in_collateral_units
|
@@ -13,6 +13,7 @@ from prediction_market_agent_tooling.gtypes import (
|
|
13
13
|
wei_type,
|
14
14
|
xDai,
|
15
15
|
xdai_type,
|
16
|
+
Probability,
|
16
17
|
)
|
17
18
|
from prediction_market_agent_tooling.loggers import logger
|
18
19
|
from prediction_market_agent_tooling.markets.agent_market import (
|
@@ -174,7 +175,7 @@ class SeerAgentMarket(AgentMarket):
|
|
174
175
|
model: SeerMarket, seer_subgraph: SeerSubgraphHandler
|
175
176
|
) -> "SeerAgentMarket":
|
176
177
|
p = PriceManager(seer_market=model, seer_subgraph=seer_subgraph)
|
177
|
-
current_p_yes = p.
|
178
|
+
current_p_yes = p.current_p_yes()
|
178
179
|
|
179
180
|
return SeerAgentMarket(
|
180
181
|
id=model.id.hex(),
|
@@ -213,7 +214,7 @@ class SeerAgentMarket(AgentMarket):
|
|
213
214
|
outcome_token_pool=None,
|
214
215
|
resolution=model.get_resolution_enum(),
|
215
216
|
volume=None,
|
216
|
-
current_p_yes=
|
217
|
+
current_p_yes=Probability(123), # ToDo dont use this method
|
217
218
|
seer_outcomes=model.outcome_as_enums,
|
218
219
|
)
|
219
220
|
|
@@ -225,11 +226,17 @@ class SeerAgentMarket(AgentMarket):
|
|
225
226
|
created_after: t.Optional[DatetimeUTC] = None,
|
226
227
|
excluded_questions: set[str] | None = None,
|
227
228
|
) -> t.Sequence["SeerAgentMarket"]:
|
228
|
-
|
229
|
+
seer_subgraph = SeerSubgraphHandler()
|
230
|
+
markets = seer_subgraph.get_binary_markets(
|
229
231
|
limit=limit, sort_by=sort_by, filter_by=filter_by
|
230
232
|
)
|
231
233
|
|
232
|
-
return [
|
234
|
+
return [
|
235
|
+
SeerAgentMarket.from_data_model_with_subgraph(
|
236
|
+
model=m, seer_subgraph=seer_subgraph
|
237
|
+
)
|
238
|
+
for m in markets
|
239
|
+
]
|
233
240
|
|
234
241
|
def has_liquidity_for_outcome(self, outcome: bool) -> bool:
|
235
242
|
outcome_token = self.get_wrapped_token_for_outcome(outcome)
|
@@ -193,7 +193,7 @@ class SeerSubgraphHandler(BaseSubgraphHandler):
|
|
193
193
|
return binary_markets
|
194
194
|
|
195
195
|
def get_market_by_id(self, market_id: HexBytes) -> SeerMarket:
|
196
|
-
markets_field = self.seer_subgraph.Query.
|
196
|
+
markets_field = self.seer_subgraph.Query.market(id=market_id.hex().lower())
|
197
197
|
fields = self._get_fields_for_markets(markets_field)
|
198
198
|
markets = self.do_query(fields=fields, pydantic_model=SeerMarket)
|
199
199
|
if len(markets) != 1:
|
@@ -62,10 +62,10 @@ prediction_market_agent_tooling/markets/polymarket/data_models_web.py,sha256=VZh
|
|
62
62
|
prediction_market_agent_tooling/markets/polymarket/polymarket.py,sha256=NRoZK71PtH8kkangMqme7twcAXhRJSSabbmOir-UnAI,3418
|
63
63
|
prediction_market_agent_tooling/markets/polymarket/utils.py,sha256=8kTeVjXPcXC6DkDvWYsZQLY7x8DS6CEp_yznSEazsNU,2037
|
64
64
|
prediction_market_agent_tooling/markets/seer/data_models.py,sha256=ECuCDqRcs9vB9rKIec399HxsL915oT7VGSwztcMfGIw,5347
|
65
|
-
prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=
|
66
|
-
prediction_market_agent_tooling/markets/seer/seer.py,sha256=
|
65
|
+
prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=PW71V364Wen-mTYsmteEX85twB50hGSNK0IclAn92qQ,4476
|
66
|
+
prediction_market_agent_tooling/markets/seer/seer.py,sha256=kBF7ALzlh0HsAgbdTa3A9XayyXrddtgi-dMWquLZX8Y,14365
|
67
67
|
prediction_market_agent_tooling/markets/seer/seer_contracts.py,sha256=TXGDbv7CI08X8N5re1SAm-X_BaXj8m4ceyzkS_ktQok,2739
|
68
|
-
prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=
|
68
|
+
prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=R4aKMZQEE9ocMqr9r4lX4so1h-HrJd2H79ElNzXXIZM,9042
|
69
69
|
prediction_market_agent_tooling/markets/seer/subgraph_data_models.py,sha256=RIt2oO-PbykzbYN11Qltt8tjjYTty-PfjH3Q4D2VEoA,1644
|
70
70
|
prediction_market_agent_tooling/monitor/financial_metrics/financial_metrics.py,sha256=fjIgjDIx5MhH5mwf7S0cspLOOSU3elYLhGYoIiM26mU,2746
|
71
71
|
prediction_market_agent_tooling/monitor/markets/manifold.py,sha256=TS4ERwTfQnot8dhekNyVNhJYf5ysYsjF-9v5_kM3aVI,3334
|
@@ -119,8 +119,8 @@ prediction_market_agent_tooling/tools/tokens/main_token.py,sha256=7JPgVF4RbiFzLD
|
|
119
119
|
prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
|
120
120
|
prediction_market_agent_tooling/tools/utils.py,sha256=jLG4nbEoIzzJiZ4RgMx4Q969Zdl0p0s63p8uET_0Fuw,6440
|
121
121
|
prediction_market_agent_tooling/tools/web3_utils.py,sha256=3wfqNxvMn44ivweFRoeKNVb9QRtFd7kFtp7VUY5juEE,12862
|
122
|
-
prediction_market_agent_tooling-0.61.1.
|
123
|
-
prediction_market_agent_tooling-0.61.1.
|
124
|
-
prediction_market_agent_tooling-0.61.1.
|
125
|
-
prediction_market_agent_tooling-0.61.1.
|
126
|
-
prediction_market_agent_tooling-0.61.1.
|
122
|
+
prediction_market_agent_tooling-0.61.1.dev487.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
123
|
+
prediction_market_agent_tooling-0.61.1.dev487.dist-info/METADATA,sha256=Z4FJ4GC4LiyTpYSZaMVpF2Zvb9a_A308yW6dRTiIq60,8636
|
124
|
+
prediction_market_agent_tooling-0.61.1.dev487.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
125
|
+
prediction_market_agent_tooling-0.61.1.dev487.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
126
|
+
prediction_market_agent_tooling-0.61.1.dev487.dist-info/RECORD,,
|
File without changes
|
File without changes
|