prediction-market-agent-tooling 0.63.0.dev515__py3-none-any.whl → 0.63.1__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.
@@ -14,7 +14,9 @@ from prediction_market_agent_tooling.markets.seer.seer_subgraph_handler import (
14
14
  SeerSubgraphHandler,
15
15
  )
16
16
  from prediction_market_agent_tooling.markets.seer.subgraph_data_models import SeerPool
17
- from prediction_market_agent_tooling.tools.cow.cow_order import get_quote
17
+ from prediction_market_agent_tooling.tools.cow.cow_order import (
18
+ get_buy_token_amount_else_raise,
19
+ )
18
20
  from prediction_market_agent_tooling.tools.hexbytes_custom import HexBytes
19
21
 
20
22
 
@@ -32,7 +34,8 @@ class PriceManager:
32
34
  def _log_track_price_normalization_diff(
33
35
  self, old_price: float, normalized_price: float, max_price_diff: float = 0.05
34
36
  ) -> None:
35
- price_diff_pct = abs(old_price - normalized_price) / old_price
37
+ # We add max(price,0.01) to avoid division by 0
38
+ price_diff_pct = abs(old_price - normalized_price) / max(old_price, 0.01)
36
39
  if price_diff_pct > max_price_diff:
37
40
  logger.info(
38
41
  f"{price_diff_pct=} larger than {max_price_diff=} for seer market {self.seer_market.id.hex()} "
@@ -74,11 +77,13 @@ class PriceManager:
74
77
  )
75
78
 
76
79
  try:
77
- quote = get_quote(
80
+ buy_token_amount = get_buy_token_amount_else_raise(
78
81
  amount_wei=collateral_exchange_amount.as_wei,
79
82
  sell_token=self.seer_market.collateral_token_contract_address_checksummed,
80
83
  buy_token=token,
81
84
  )
85
+ price = collateral_exchange_amount.as_wei / buy_token_amount
86
+ return CollateralToken(price)
82
87
 
83
88
  except Exception as e:
84
89
  logger.warning(
@@ -86,9 +91,6 @@ class PriceManager:
86
91
  )
87
92
  return self.get_token_price_from_pools(token=token)
88
93
 
89
- price = collateral_exchange_amount / float(quote.quote.buyAmount.root)
90
- return price
91
-
92
94
  @staticmethod
93
95
  def _pool_token0_matches_token(token: ChecksumAddress, pool: SeerPool) -> bool:
94
96
  return pool.token0.id.hex().lower() == token.lower()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.63.0.dev515
3
+ Version: 0.63.1
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=GaDaFIz1jMgUUg4TpR-FdIF-_-C6pX4sjp3xTLi8KyI,4691
65
+ prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=NZdMXRzOiGq8n4YarOQiIGGpYTNm0XUy9x8HZWmS7Es,4836
66
66
  prediction_market_agent_tooling/markets/seer/seer.py,sha256=PQ685AE9BjH4QZC_zcTCGt7RNBRI6wKkXoCUvQeMDO0,14897
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
@@ -121,8 +121,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=Qq8ofVCCMX-eo8mDlHv4g
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.0.dev515.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
125
- prediction_market_agent_tooling-0.63.0.dev515.dist-info/METADATA,sha256=21FwYtrxHrjOMGPe6uNNPDSpQDBoVYc4J0EmMCdako4,8696
126
- prediction_market_agent_tooling-0.63.0.dev515.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
127
- prediction_market_agent_tooling-0.63.0.dev515.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
128
- prediction_market_agent_tooling-0.63.0.dev515.dist-info/RECORD,,
124
+ prediction_market_agent_tooling-0.63.1.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
125
+ prediction_market_agent_tooling-0.63.1.dist-info/METADATA,sha256=cpCiRflWwNgAuRkyel1R4e_w_FxZMHpp_o9hjvDUHws,8689
126
+ prediction_market_agent_tooling-0.63.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
127
+ prediction_market_agent_tooling-0.63.1.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
128
+ prediction_market_agent_tooling-0.63.1.dist-info/RECORD,,