prediction-market-agent-tooling 0.63.2__py3-none-any.whl → 0.63.3__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.
@@ -1,3 +1,5 @@
1
+ import typing as t
2
+
1
3
  from cachetools import TTLCache, cached
2
4
  from web3 import Web3
3
5
 
@@ -21,6 +23,27 @@ from prediction_market_agent_tooling.tools.cow.cow_order import (
21
23
  from prediction_market_agent_tooling.tools.hexbytes_custom import HexBytes
22
24
 
23
25
 
26
+ def _make_cache_key(
27
+ *args: t.Any,
28
+ token: ChecksumAddress,
29
+ collateral_exchange_amount: CollateralToken | None = None,
30
+ ) -> str:
31
+ """
32
+ Generate a unique cache key based on a token address and optional collateral token.
33
+ """
34
+
35
+ if collateral_exchange_amount is None:
36
+ return f"{token}-no_collateral"
37
+
38
+ return "-".join(
39
+ [
40
+ token,
41
+ collateral_exchange_amount.symbol,
42
+ str(collateral_exchange_amount.value),
43
+ ]
44
+ )
45
+
46
+
24
47
  class PriceManager:
25
48
  def __init__(self, seer_market: SeerMarket, seer_subgraph: SeerSubgraphHandler):
26
49
  self.seer_market = seer_market
@@ -66,7 +89,7 @@ class PriceManager:
66
89
  else:
67
90
  return None
68
91
 
69
- @cached(TTLCache(maxsize=100, ttl=5 * 60))
92
+ @cached(TTLCache(maxsize=100, ttl=5 * 60), key=_make_cache_key)
70
93
  def get_price_for_token(
71
94
  self,
72
95
  token: ChecksumAddress,
@@ -231,6 +231,9 @@ class _GenericValue(
231
231
  def __bool__(self) -> bool:
232
232
  return bool(self.value)
233
233
 
234
+ def __hash__(self) -> int: # type: ignore[override]
235
+ return hash(tuple(sorted(self.items())))
236
+
234
237
  @classmethod
235
238
  def __get_pydantic_core_schema__(
236
239
  cls, source_type: t.Any, handler: GetCoreSchemaHandler
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.63.2
3
+ Version: 0.63.3
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -62,7 +62,7 @@ prediction_market_agent_tooling/markets/polymarket/data_models_web.py,sha256=LVE
62
62
  prediction_market_agent_tooling/markets/polymarket/polymarket.py,sha256=6rc9qulPl90MxXKB55XiiWKLhjfAyG_eUzAlqpq1UIE,3339
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=FwTOq9X2iJ7r3ijtE0evl8pMSbFPm4lUwuc9m7YsMVA,6373
65
- prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=PtGD9cm8JlxVTkSD-QgZuh_gWfG7WATakh8-t0szomk,4924
65
+ prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=EuOe6zCmEEWXz1loXaQQOYC7ZNQ0cDJn0rZadK1dBlc,5460
66
66
  prediction_market_agent_tooling/markets/seer/seer.py,sha256=_FzFGTkaOHQ2WTkUa_ba-Tc9zqw4KTmbCTrH4EmvOsU,16035
67
67
  prediction_market_agent_tooling/markets/seer/seer_contracts.py,sha256=yufEojZxLa_SQv9xhsG23wLGsyHOWD8Azm7-7E5Zn_8,2714
68
68
  prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=KKRI493VNNAY9tR1AjzNraeH76MvDsBV6GsiLZas0_Y,9859
@@ -76,7 +76,7 @@ prediction_market_agent_tooling/monitor/monitor.py,sha256=yvSXwV-3DSAm3vsFZnFC9j
76
76
  prediction_market_agent_tooling/monitor/monitor_app.py,sha256=-_6w_ZvQ-Ad5qaeuo7NKTXUOOZ_6OrR8jMe25BGOY4k,4615
77
77
  prediction_market_agent_tooling/monitor/monitor_settings.py,sha256=Xiozs3AsufuJ04JOe1vjUri-IAMWHjjmc2ugGGiHNH4,947
78
78
  prediction_market_agent_tooling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
- prediction_market_agent_tooling/tools/_generic_value.py,sha256=0_EDybTsr3iXqPPqy2U1WMw4st_SlYaCrf2p1MZhED4,10511
79
+ prediction_market_agent_tooling/tools/_generic_value.py,sha256=pD_PI13lpPp1gFoljHwa_Lzlp-u2pu0m-Z7LcxwDM2U,10618
80
80
  prediction_market_agent_tooling/tools/balances.py,sha256=Osab21btfJDw2Y-jT_TV-KHGrseCRxcsYeW6WcOMB8E,1050
81
81
  prediction_market_agent_tooling/tools/betting_strategies/kelly_criterion.py,sha256=L9yp3m_81i-y85dGZH1rYRv9YXYYt1w3RGroFAAYSbw,4873
82
82
  prediction_market_agent_tooling/tools/betting_strategies/market_moving.py,sha256=36ucOuF38bdB4rnSPNjC1qpidBo30Ff4P5Kb-7emKEQ,5469
@@ -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=eYCc1iWAVtqDKUPTwnMUHuYolPdwh_OTiM3-AdRgDp4,12198
124
- prediction_market_agent_tooling-0.63.2.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
125
- prediction_market_agent_tooling-0.63.2.dist-info/METADATA,sha256=8842h65SdEztkGfvqLpAOdd1DdOrrJ7eFtSQtBcQYcA,8689
126
- prediction_market_agent_tooling-0.63.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
127
- prediction_market_agent_tooling-0.63.2.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
128
- prediction_market_agent_tooling-0.63.2.dist-info/RECORD,,
124
+ prediction_market_agent_tooling-0.63.3.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
125
+ prediction_market_agent_tooling-0.63.3.dist-info/METADATA,sha256=0RZTVpeWNV3EurtBs_MQ55JxJVW1EmHzuxKQsVpAHHU,8689
126
+ prediction_market_agent_tooling-0.63.3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
127
+ prediction_market_agent_tooling-0.63.3.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
128
+ prediction_market_agent_tooling-0.63.3.dist-info/RECORD,,