prediction-market-agent-tooling 0.63.4__py3-none-any.whl → 0.63.5__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/omen/data_models.py +24 -1
- prediction_market_agent_tooling/markets/omen/omen.py +1 -9
- {prediction_market_agent_tooling-0.63.4.dist-info → prediction_market_agent_tooling-0.63.5.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.63.4.dist-info → prediction_market_agent_tooling-0.63.5.dist-info}/RECORD +7 -7
- {prediction_market_agent_tooling-0.63.4.dist-info → prediction_market_agent_tooling-0.63.5.dist-info}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.63.4.dist-info → prediction_market_agent_tooling-0.63.5.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.63.4.dist-info → prediction_market_agent_tooling-0.63.5.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
import typing as t
|
2
2
|
|
3
|
-
from pydantic import BaseModel, ConfigDict, Field, computed_field
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field, computed_field, model_validator
|
4
4
|
from web3 import Web3
|
5
5
|
|
6
6
|
from prediction_market_agent_tooling.gtypes import (
|
@@ -17,6 +17,7 @@ from prediction_market_agent_tooling.gtypes import (
|
|
17
17
|
xDai,
|
18
18
|
xDaiWei,
|
19
19
|
)
|
20
|
+
from prediction_market_agent_tooling.loggers import logger
|
20
21
|
from prediction_market_agent_tooling.markets.data_models import (
|
21
22
|
Bet,
|
22
23
|
Resolution,
|
@@ -35,6 +36,7 @@ from prediction_market_agent_tooling.tools.utils import (
|
|
35
36
|
should_not_happen,
|
36
37
|
utcnow,
|
37
38
|
)
|
39
|
+
from prediction_market_agent_tooling.tools.web3_utils import is_valid_wei
|
38
40
|
|
39
41
|
OMEN_TRUE_OUTCOME = OutcomeStr("Yes")
|
40
42
|
OMEN_FALSE_OUTCOME = OutcomeStr("No")
|
@@ -235,6 +237,27 @@ class OmenMarket(BaseModel):
|
|
235
237
|
condition: Condition
|
236
238
|
question: Question
|
237
239
|
|
240
|
+
@model_validator(mode="after")
|
241
|
+
def _model_validator(self) -> "OmenMarket":
|
242
|
+
if not all(is_valid_wei(number.value) for number in self.outcomeTokenAmounts):
|
243
|
+
# Sometimes we receive markets with outcomeTokenAmounts as `model.outcomeTokenAmounts=[OutcomeWei(24662799387878572), OutcomeWei(-24750000000000000)]`, which should be impossible.
|
244
|
+
# Current huntch is that it's a weird transitional status.
|
245
|
+
# Try to set them to zeros if market isn't open anymore (that's expected behaviour in such case),
|
246
|
+
# otherwise raise an error to investigate further.
|
247
|
+
if not self.is_open:
|
248
|
+
logger.warning(
|
249
|
+
f"Market {self.url} has invalid {self.outcomeTokenAmounts=}, but isn't open anymore. Setting them to zeros."
|
250
|
+
)
|
251
|
+
self.outcomeTokenAmounts = [OutcomeWei(0) for _ in self.outcomes]
|
252
|
+
self.outcomeTokenMarginalPrices = None
|
253
|
+
|
254
|
+
else:
|
255
|
+
raise ValueError(
|
256
|
+
f"Market {self.url} has invalid {self.outcomeTokenAmounts=}: {self=}"
|
257
|
+
)
|
258
|
+
|
259
|
+
return self
|
260
|
+
|
238
261
|
@property
|
239
262
|
def openingTimestamp(self) -> int:
|
240
263
|
# This field is also available on this model itself, but for some reason it's typed to be optional,
|
@@ -86,10 +86,7 @@ from prediction_market_agent_tooling.tools.utils import (
|
|
86
86
|
calculate_sell_amount_in_collateral,
|
87
87
|
check_not_none,
|
88
88
|
)
|
89
|
-
from prediction_market_agent_tooling.tools.web3_utils import
|
90
|
-
get_receipt_block_timestamp,
|
91
|
-
is_valid_wei,
|
92
|
-
)
|
89
|
+
from prediction_market_agent_tooling.tools.web3_utils import get_receipt_block_timestamp
|
93
90
|
|
94
91
|
OMEN_DEFAULT_REALITIO_BOND_VALUE = xDai(0.01)
|
95
92
|
OMEN_TINY_BET_AMOUNT = USD(0.00001)
|
@@ -339,11 +336,6 @@ class OmenAgentMarket(AgentMarket):
|
|
339
336
|
|
340
337
|
@staticmethod
|
341
338
|
def from_data_model(model: OmenMarket) -> "OmenAgentMarket":
|
342
|
-
if not all(is_valid_wei(number.value) for number in model.outcomeTokenAmounts):
|
343
|
-
raise ValueError(
|
344
|
-
f"Market {model.url} has invalid {model.outcomeTokenAmounts=}."
|
345
|
-
)
|
346
|
-
|
347
339
|
return OmenAgentMarket(
|
348
340
|
id=model.id,
|
349
341
|
question=model.title,
|
@@ -50,8 +50,8 @@ prediction_market_agent_tooling/markets/metaculus/api.py,sha256=4TRPGytQQbSdf42D
|
|
50
50
|
prediction_market_agent_tooling/markets/metaculus/data_models.py,sha256=FaBCTPPezXbBwZ9p791CiVgQ4vB696xnMbz9XVXmiVI,3267
|
51
51
|
prediction_market_agent_tooling/markets/metaculus/metaculus.py,sha256=86TIx6cavEWc8Cv4KpZxSvwiSw9oFybXE3YB49pg-CA,4377
|
52
52
|
prediction_market_agent_tooling/markets/omen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
|
-
prediction_market_agent_tooling/markets/omen/data_models.py,sha256=
|
54
|
-
prediction_market_agent_tooling/markets/omen/omen.py,sha256=
|
53
|
+
prediction_market_agent_tooling/markets/omen/data_models.py,sha256=T08irohOXQnNeL45mIhGYgpJTShHVgXvQyYnLX4YLmU,30477
|
54
|
+
prediction_market_agent_tooling/markets/omen/omen.py,sha256=Jf2qSJJn0UUISpi24xYRwoVycGuYE42kZ2z1HRGl43w,51927
|
55
55
|
prediction_market_agent_tooling/markets/omen/omen_constants.py,sha256=D9oflYKafLQiHYtB5sScMHqmXyzM8JP8J0yATmc4SQQ,233
|
56
56
|
prediction_market_agent_tooling/markets/omen/omen_contracts.py,sha256=bCC9A7ZTJxMDJcPbl3jof6HcAGGHv1BrFq3RRWbkQ_c,28739
|
57
57
|
prediction_market_agent_tooling/markets/omen/omen_resolving.py,sha256=Cyi9Ci-Z-K8WCZWVLs9oSuJC6qRobi_CpqDCno_5F-0,10238
|
@@ -121,8 +121,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=yuW8iPPtcpP4eLH2nORMD
|
|
121
121
|
prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
|
122
122
|
prediction_market_agent_tooling/tools/utils.py,sha256=1xsyBBJfiEdSoMlceB2F8o2sCb6Z8-qNz11pEJFrdyE,6566
|
123
123
|
prediction_market_agent_tooling/tools/web3_utils.py,sha256=zRq-eeBGWt8uUGN9G_WfjmJ0eVvO8aWE9S0Pz_Y6AOA,12342
|
124
|
-
prediction_market_agent_tooling-0.63.
|
125
|
-
prediction_market_agent_tooling-0.63.
|
126
|
-
prediction_market_agent_tooling-0.63.
|
127
|
-
prediction_market_agent_tooling-0.63.
|
128
|
-
prediction_market_agent_tooling-0.63.
|
124
|
+
prediction_market_agent_tooling-0.63.5.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
125
|
+
prediction_market_agent_tooling-0.63.5.dist-info/METADATA,sha256=IaLaaqZx0vS4t15q4zcpbXt_leP49eUYv8K7rGUh-p8,8689
|
126
|
+
prediction_market_agent_tooling-0.63.5.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
127
|
+
prediction_market_agent_tooling-0.63.5.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
128
|
+
prediction_market_agent_tooling-0.63.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|