prediction-market-agent-tooling 0.65.7__tar.gz → 0.65.9__tar.gz

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.
Files changed (128) hide show
  1. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/PKG-INFO +1 -1
  2. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/deploy/agent.py +3 -10
  3. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/agent_market.py +4 -0
  4. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/manifold/data_models.py +5 -3
  5. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/manifold/manifold.py +17 -1
  6. prediction_market_agent_tooling-0.65.9/prediction_market_agent_tooling/markets/manifold/utils.py +16 -0
  7. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/markets.py +1 -47
  8. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/omen/omen.py +9 -0
  9. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/omen/omen_resolving.py +23 -9
  10. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/seer/seer.py +17 -0
  11. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/cow/cow_order.py +37 -6
  12. prediction_market_agent_tooling-0.65.9/prediction_market_agent_tooling/tools/cow/models.py +16 -0
  13. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/utils.py +10 -0
  14. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/pyproject.toml +1 -1
  15. prediction_market_agent_tooling-0.65.7/prediction_market_agent_tooling/markets/manifold/utils.py +0 -10
  16. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/LICENSE +0 -0
  17. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/README.md +0 -0
  18. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/debuggingcontract.abi.json +0 -0
  19. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/depositablewrapper_erc20.abi.json +0 -0
  20. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/erc20.abi.json +0 -0
  21. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/erc4626.abi.json +0 -0
  22. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/erc721.abi.json +0 -0
  23. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/gvp2_settlement.abi.json +0 -0
  24. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_agentresultmapping.abi.json +0 -0
  25. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_dxdao.abi.json +0 -0
  26. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_fpmm.abi.json +0 -0
  27. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_fpmm_conditionaltokens.abi.json +0 -0
  28. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_fpmm_factory.abi.json +0 -0
  29. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_kleros.abi.json +0 -0
  30. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_oracle.abi.json +0 -0
  31. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_realitio.abi.json +0 -0
  32. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/omen_thumbnailmapping.abi.json +0 -0
  33. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/ownable.abi.json +0 -0
  34. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/ownable_erc721.abi.json +0 -0
  35. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/proxy.abi.json +0 -0
  36. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/seer_gnosis_router.abi.json +0 -0
  37. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/abis/seer_market_factory.abi.json +0 -0
  38. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/benchmark/__init__.py +0 -0
  39. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/benchmark/agents.py +0 -0
  40. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/benchmark/benchmark.py +0 -0
  41. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/benchmark/utils.py +0 -0
  42. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/chains.py +0 -0
  43. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/config.py +0 -0
  44. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/deploy/agent_example.py +0 -0
  45. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/deploy/betting_strategy.py +0 -0
  46. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/deploy/constants.py +0 -0
  47. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/deploy/gcp/deploy.py +0 -0
  48. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/deploy/gcp/kubernetes_models.py +0 -0
  49. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/deploy/gcp/utils.py +0 -0
  50. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/deploy/trade_interval.py +0 -0
  51. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/gtypes.py +0 -0
  52. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/jobs/__init__.py +0 -0
  53. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/jobs/jobs_models.py +0 -0
  54. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/jobs/omen/omen_jobs.py +0 -0
  55. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/loggers.py +0 -0
  56. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/logprobs_parser.py +0 -0
  57. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/base_subgraph_handler.py +0 -0
  58. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/blockchain_utils.py +0 -0
  59. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/categorize.py +0 -0
  60. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/data_models.py +0 -0
  61. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/manifold/__init__.py +0 -0
  62. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/manifold/api.py +0 -0
  63. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/market_fees.py +0 -0
  64. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/metaculus/api.py +0 -0
  65. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/metaculus/data_models.py +0 -0
  66. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/metaculus/metaculus.py +0 -0
  67. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/omen/__init__.py +0 -0
  68. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/omen/cow_contracts.py +0 -0
  69. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/omen/data_models.py +0 -0
  70. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/omen/omen_constants.py +0 -0
  71. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/omen/omen_contracts.py +0 -0
  72. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py +0 -0
  73. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/polymarket/api.py +0 -0
  74. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/polymarket/data_models.py +0 -0
  75. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/polymarket/data_models_web.py +0 -0
  76. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/polymarket/polymarket.py +0 -0
  77. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/polymarket/utils.py +0 -0
  78. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/seer/data_models.py +0 -0
  79. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/seer/exceptions.py +0 -0
  80. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/seer/price_manager.py +0 -0
  81. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/seer/seer_contracts.py +0 -0
  82. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py +0 -0
  83. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/markets/seer/subgraph_data_models.py +0 -0
  84. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/py.typed +0 -0
  85. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/_generic_value.py +0 -0
  86. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/balances.py +0 -0
  87. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/betting_strategies/kelly_criterion.py +0 -0
  88. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/betting_strategies/stretch_bet_between.py +0 -0
  89. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/betting_strategies/utils.py +0 -0
  90. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/caches/db_cache.py +0 -0
  91. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/caches/inmemory_cache.py +0 -0
  92. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/caches/serializers.py +0 -0
  93. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/contract.py +0 -0
  94. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/costs.py +0 -0
  95. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/custom_exceptions.py +0 -0
  96. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/datetime_utc.py +0 -0
  97. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/db/db_manager.py +0 -0
  98. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/google_utils.py +0 -0
  99. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/hexbytes_custom.py +0 -0
  100. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/httpx_cached_client.py +0 -0
  101. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/image_gen/image_gen.py +0 -0
  102. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/image_gen/market_thumbnail_gen.py +0 -0
  103. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/ipfs/ipfs_handler.py +0 -0
  104. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/is_invalid.py +0 -0
  105. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/is_predictable.py +0 -0
  106. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/langfuse_.py +0 -0
  107. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/langfuse_client_utils.py +0 -0
  108. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/omen/reality_accuracy.py +0 -0
  109. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/omen/sell_positions.py +0 -0
  110. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/parallelism.py +0 -0
  111. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/perplexity/perplexity_client.py +0 -0
  112. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/perplexity/perplexity_models.py +0 -0
  113. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/perplexity/perplexity_search.py +0 -0
  114. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/relevant_news_analysis/data_models.py +0 -0
  115. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_analysis.py +0 -0
  116. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_cache.py +0 -0
  117. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/safe.py +0 -0
  118. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/singleton.py +0 -0
  119. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/streamlit_user_login.py +0 -0
  120. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/tavily/tavily_models.py +0 -0
  121. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/tavily/tavily_search.py +0 -0
  122. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/tokens/auto_deposit.py +0 -0
  123. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/tokens/auto_withdraw.py +0 -0
  124. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/tokens/main_token.py +0 -0
  125. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/tokens/token_utils.py +0 -0
  126. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/tokens/usd.py +0 -0
  127. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/transaction_cache.py +0 -0
  128. {prediction_market_agent_tooling-0.65.7 → prediction_market_agent_tooling-0.65.9}/prediction_market_agent_tooling/tools/web3_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.65.7
3
+ Version: 0.65.9
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -33,10 +33,7 @@ from prediction_market_agent_tooling.markets.data_models import (
33
33
  ProbabilisticAnswer,
34
34
  Trade,
35
35
  )
36
- from prediction_market_agent_tooling.markets.markets import (
37
- MarketType,
38
- have_bet_on_market_since,
39
- )
36
+ from prediction_market_agent_tooling.markets.markets import MarketType
40
37
  from prediction_market_agent_tooling.markets.omen.omen import (
41
38
  send_keeping_token_to_eoa_xdai,
42
39
  )
@@ -219,7 +216,6 @@ class DeployablePredictionAgent(DeployableAgent):
219
216
  def initialize_langfuse(self) -> None:
220
217
  super().initialize_langfuse()
221
218
  # Auto-observe all the methods where it makes sense, so that subclassses don't need to do it manually.
222
- self.have_bet_on_market_since = observe()(self.have_bet_on_market_since) # type: ignore[method-assign]
223
219
  self.verify_market = observe()(self.verify_market) # type: ignore[method-assign]
224
220
  self.answer_binary_market = observe()(self.answer_binary_market) # type: ignore[method-assign]
225
221
  self.answer_categorical_market = observe()(self.answer_categorical_market) # type: ignore[method-assign]
@@ -265,16 +261,13 @@ class DeployablePredictionAgent(DeployableAgent):
265
261
  f"{api_keys=} doesn't have enough operational balance."
266
262
  )
267
263
 
268
- def have_bet_on_market_since(self, market: AgentMarket, since: timedelta) -> bool:
269
- return have_bet_on_market_since(keys=APIKeys(), market=market, since=since)
270
-
271
264
  def verify_market(self, market_type: MarketType, market: AgentMarket) -> bool:
272
265
  """
273
266
  Subclasses can implement their own logic instead of this one, or on top of this one.
274
267
  By default, it allows only markets where user didn't bet recently and it's a reasonable question.
275
268
  """
276
- if self.have_bet_on_market_since(
277
- market, since=self.same_market_trade_interval.get(market=market)
269
+ if market.have_bet_on_market_since(
270
+ keys=APIKeys(), since=self.same_market_trade_interval.get(market=market)
278
271
  ):
279
272
  logger.info(
280
273
  f"Market already bet on within {self.same_market_trade_interval}."
@@ -1,4 +1,5 @@
1
1
  import typing as t
2
+ from datetime import timedelta
2
3
  from enum import Enum
3
4
  from math import prod
4
5
 
@@ -115,6 +116,9 @@ class AgentMarket(BaseModel):
115
116
  )
116
117
  return outcome_token_pool
117
118
 
119
+ def have_bet_on_market_since(self, keys: APIKeys, since: timedelta) -> bool:
120
+ raise NotImplementedError("Subclasses must implement this method")
121
+
118
122
  def get_outcome_token_pool_by_outcome(self, outcome: OutcomeStr) -> OutcomeToken:
119
123
  if self.outcome_token_pool is None or not self.outcome_token_pool:
120
124
  return OutcomeToken(0)
@@ -12,7 +12,9 @@ from prediction_market_agent_tooling.gtypes import (
12
12
  Probability,
13
13
  )
14
14
  from prediction_market_agent_tooling.markets.data_models import Resolution
15
- from prediction_market_agent_tooling.markets.manifold.utils import validate_resolution
15
+ from prediction_market_agent_tooling.markets.manifold.utils import (
16
+ validate_manifold_resolution,
17
+ )
16
18
  from prediction_market_agent_tooling.tools.utils import DatetimeUTC, should_not_happen
17
19
 
18
20
  MANIFOLD_BASE_URL = "https://manifold.markets"
@@ -110,7 +112,7 @@ class ManifoldMarket(BaseModel):
110
112
 
111
113
  @field_validator("resolution", mode="before")
112
114
  def validate_resolution(cls, v: t.Any) -> Resolution:
113
- return validate_resolution(v)
115
+ return validate_manifold_resolution(v)
114
116
 
115
117
  def __repr__(self) -> str:
116
118
  return f"Manifold's market: {self.question}"
@@ -204,7 +206,7 @@ class ManifoldBet(BaseModel):
204
206
 
205
207
  @field_validator("outcome", mode="before")
206
208
  def validate_resolution(cls, v: t.Any) -> Resolution:
207
- return validate_resolution(v)
209
+ return validate_manifold_resolution(v)
208
210
 
209
211
  def get_resolved_outcome(self) -> OutcomeStr:
210
212
  if self.outcome.outcome:
@@ -1,4 +1,5 @@
1
1
  import typing as t
2
+ from datetime import timedelta
2
3
 
3
4
  from prediction_market_agent_tooling.config import APIKeys
4
5
  from prediction_market_agent_tooling.gtypes import (
@@ -15,6 +16,7 @@ from prediction_market_agent_tooling.markets.agent_market import (
15
16
  )
16
17
  from prediction_market_agent_tooling.markets.manifold.api import (
17
18
  get_authenticated_user,
19
+ get_manifold_bets,
18
20
  get_manifold_binary_markets,
19
21
  get_manifold_market,
20
22
  place_bet,
@@ -24,7 +26,7 @@ from prediction_market_agent_tooling.markets.manifold.data_models import (
24
26
  FullManifoldMarket,
25
27
  usd_to_mana,
26
28
  )
27
- from prediction_market_agent_tooling.tools.utils import DatetimeUTC
29
+ from prediction_market_agent_tooling.tools.utils import DatetimeUTC, utcnow
28
30
 
29
31
 
30
32
  class ManifoldAgentMarket(AgentMarket):
@@ -51,6 +53,20 @@ class ManifoldAgentMarket(AgentMarket):
51
53
  def get_tiny_bet_amount(self) -> CollateralToken:
52
54
  return CollateralToken(1)
53
55
 
56
+ def have_bet_on_market_since(self, keys: APIKeys, since: timedelta) -> bool:
57
+ start_time = utcnow() - since
58
+ recently_betted_questions = set(
59
+ get_manifold_market(b.contractId).question
60
+ for b in get_manifold_bets(
61
+ user_id=get_authenticated_user(
62
+ keys.manifold_api_key.get_secret_value()
63
+ ).id,
64
+ start_time=start_time,
65
+ end_time=None,
66
+ )
67
+ )
68
+ return self.question in recently_betted_questions
69
+
54
70
  def place_bet(self, outcome: OutcomeStr, amount: USD) -> str:
55
71
  self.get_usd_in_token(amount)
56
72
  bet = place_bet(
@@ -0,0 +1,16 @@
1
+ import typing as t
2
+
3
+ from prediction_market_agent_tooling.gtypes import OutcomeStr
4
+ from prediction_market_agent_tooling.markets.data_models import Resolution
5
+
6
+ MANIFOLD_CANCEL_OUTCOME = "CANCEL"
7
+
8
+
9
+ def validate_manifold_resolution(v: t.Any) -> Resolution:
10
+ if isinstance(v, str):
11
+ return (
12
+ Resolution(outcome=OutcomeStr(v), invalid=False)
13
+ if v != MANIFOLD_CANCEL_OUTCOME
14
+ else Resolution(outcome=None, invalid=True)
15
+ )
16
+ raise ValueError(f"Expected a string, got {v} {type(v)}")
@@ -1,8 +1,6 @@
1
1
  import typing as t
2
- from datetime import timedelta
3
2
  from enum import Enum
4
3
 
5
- from prediction_market_agent_tooling.config import APIKeys
6
4
  from prediction_market_agent_tooling.jobs.jobs_models import JobAgentMarket
7
5
  from prediction_market_agent_tooling.jobs.omen.omen_jobs import OmenJobAgentMarket
8
6
  from prediction_market_agent_tooling.markets.agent_market import (
@@ -10,11 +8,6 @@ from prediction_market_agent_tooling.markets.agent_market import (
10
8
  FilterBy,
11
9
  SortBy,
12
10
  )
13
- from prediction_market_agent_tooling.markets.manifold.api import (
14
- get_authenticated_user,
15
- get_manifold_bets,
16
- get_manifold_market,
17
- )
18
11
  from prediction_market_agent_tooling.markets.manifold.manifold import (
19
12
  ManifoldAgentMarket,
20
13
  )
@@ -22,18 +15,11 @@ from prediction_market_agent_tooling.markets.metaculus.metaculus import (
22
15
  MetaculusAgentMarket,
23
16
  )
24
17
  from prediction_market_agent_tooling.markets.omen.omen import OmenAgentMarket
25
- from prediction_market_agent_tooling.markets.omen.omen_subgraph_handler import (
26
- OmenSubgraphHandler,
27
- )
28
18
  from prediction_market_agent_tooling.markets.polymarket.polymarket import (
29
19
  PolymarketAgentMarket,
30
20
  )
31
21
  from prediction_market_agent_tooling.markets.seer.seer import SeerAgentMarket
32
- from prediction_market_agent_tooling.tools.utils import (
33
- DatetimeUTC,
34
- should_not_happen,
35
- utcnow,
36
- )
22
+ from prediction_market_agent_tooling.tools.utils import DatetimeUTC
37
23
 
38
24
 
39
25
  class MarketType(str, Enum):
@@ -92,35 +78,3 @@ def get_binary_markets(
92
78
  excluded_questions=excluded_questions,
93
79
  )
94
80
  return markets
95
-
96
-
97
- def have_bet_on_market_since(
98
- keys: APIKeys, market: AgentMarket, since: timedelta
99
- ) -> bool:
100
- start_time = utcnow() - since
101
- recently_betted_questions = (
102
- set(
103
- get_manifold_market(b.contractId).question
104
- for b in get_manifold_bets(
105
- user_id=get_authenticated_user(
106
- keys.manifold_api_key.get_secret_value()
107
- ).id,
108
- start_time=start_time,
109
- end_time=None,
110
- )
111
- )
112
- if isinstance(market, ManifoldAgentMarket)
113
- else (
114
- set(
115
- b.title
116
- for b in OmenSubgraphHandler().get_bets(
117
- better_address=keys.bet_from_address,
118
- start_time=start_time,
119
- market_id=market.market_maker_contract_address_checksummed,
120
- )
121
- )
122
- if isinstance(market, OmenAgentMarket)
123
- else should_not_happen(f"Unknown market: {market}")
124
- )
125
- )
126
- return market.question in recently_betted_questions
@@ -84,6 +84,7 @@ from prediction_market_agent_tooling.tools.utils import (
84
84
  DatetimeUTC,
85
85
  calculate_sell_amount_in_collateral,
86
86
  check_not_none,
87
+ utcnow,
87
88
  )
88
89
  from prediction_market_agent_tooling.tools.web3_utils import get_receipt_block_timestamp
89
90
 
@@ -157,6 +158,14 @@ class OmenAgentMarket(AgentMarket):
157
158
  def get_usd_in_token(self, x: USD) -> CollateralToken:
158
159
  return get_usd_in_token(x, self.collateral_token_contract_address_checksummed)
159
160
 
161
+ def have_bet_on_market_since(self, keys: APIKeys, since: timedelta) -> bool:
162
+ start_time = utcnow() - since
163
+ prev_bets = self.get_bets_made_since(
164
+ better_address=keys.bet_from_address, start_time=start_time
165
+ )
166
+
167
+ return self.id in [b.market_id for b in prev_bets]
168
+
160
169
  def liquidate_existing_positions(
161
170
  self,
162
171
  bet_outcome: OutcomeStr,
@@ -31,7 +31,11 @@ from prediction_market_agent_tooling.markets.omen.omen_subgraph_handler import (
31
31
  from prediction_market_agent_tooling.tools.tokens.main_token import (
32
32
  MINIMUM_NATIVE_TOKEN_IN_EOA_FOR_FEES,
33
33
  )
34
- from prediction_market_agent_tooling.tools.utils import check_not_none, utcnow
34
+ from prediction_market_agent_tooling.tools.utils import (
35
+ check_not_none,
36
+ extract_error_from_retry_error,
37
+ utcnow,
38
+ )
35
39
  from prediction_market_agent_tooling.tools.web3_utils import ZERO_BYTES
36
40
 
37
41
 
@@ -264,14 +268,24 @@ def omen_resolve_market_tx(
264
268
  Market can be resolved after the answer if finalized on Reality.
265
269
  """
266
270
  oracle_contract = OmenOracleContract()
267
- oracle_contract.resolve(
268
- api_keys=api_keys,
269
- question_id=market.question.id,
270
- template_id=market.question.templateId,
271
- question_raw=market.question.question_raw,
272
- n_outcomes=market.question.n_outcomes,
273
- web3=web3,
274
- )
271
+ try:
272
+ oracle_contract.resolve(
273
+ api_keys=api_keys,
274
+ question_id=market.question.id,
275
+ template_id=market.question.templateId,
276
+ question_raw=market.question.question_raw,
277
+ n_outcomes=market.question.n_outcomes,
278
+ web3=web3,
279
+ )
280
+ except BaseException as e:
281
+ e = extract_error_from_retry_error(e)
282
+ if "condition not prepared or found" in str(e):
283
+ # We can't do anything about these, so just skip them with warning.
284
+ logger.warning(
285
+ f"Market {market.url=} not resolved, because `condition not prepared or found`, skipping."
286
+ )
287
+ else:
288
+ raise
275
289
 
276
290
 
277
291
  def find_resolution_on_other_markets(market: OmenMarket) -> Resolution | None:
@@ -1,4 +1,5 @@
1
1
  import typing as t
2
+ from datetime import timedelta
2
3
 
3
4
  from eth_typing import ChecksumAddress
4
5
  from web3 import Web3
@@ -52,6 +53,7 @@ from prediction_market_agent_tooling.tools.contract import (
52
53
  )
53
54
  from prediction_market_agent_tooling.tools.cow.cow_order import (
54
55
  get_buy_token_amount_else_raise,
56
+ get_orders_by_owner,
55
57
  get_trades_by_owner,
56
58
  swap_tokens_waiting,
57
59
  )
@@ -63,6 +65,7 @@ from prediction_market_agent_tooling.tools.tokens.usd import (
63
65
  get_token_in_usd,
64
66
  get_usd_in_token,
65
67
  )
68
+ from prediction_market_agent_tooling.tools.utils import utcnow
66
69
 
67
70
  # We place a larger bet amount by default than Omen so that cow presents valid quotes.
68
71
  SEER_TINY_BET_AMOUNT = USD(0.1)
@@ -272,6 +275,20 @@ class SeerAgentMarket(AgentMarket):
272
275
 
273
276
  # GnosisRouter withdraws sDai into wxDAI/xDai on its own, so no auto-withdraw needed by us.
274
277
 
278
+ def have_bet_on_market_since(self, keys: APIKeys, since: timedelta) -> bool:
279
+ """Check if the user has placed a bet on this market since a specific time using Cow API."""
280
+ # Cow endpoint doesn't allow us to filter by time.
281
+ start_time = utcnow() - since
282
+ prev_orders = get_orders_by_owner(owner=keys.bet_from_address)
283
+ for order in prev_orders:
284
+ if order.creationDate >= start_time and {
285
+ Web3.to_checksum_address(order.sellToken),
286
+ Web3.to_checksum_address(order.buyToken),
287
+ }.intersection(set(self.wrapped_tokens)):
288
+ return True
289
+
290
+ return False
291
+
275
292
  @staticmethod
276
293
  def verify_operational_balance(api_keys: APIKeys) -> bool:
277
294
  return OmenAgentMarket.verify_operational_balance(api_keys=api_keys)
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import typing as t
2
3
  from datetime import timedelta
3
4
 
4
5
  import httpx
@@ -23,7 +24,6 @@ from cowdao_cowpy.order_book.generated.model import (
23
24
  OrderStatus,
24
25
  TokenAmount,
25
26
  )
26
- from cowdao_cowpy.subgraph.client import BaseModel
27
27
  from tenacity import (
28
28
  retry_if_not_exception_type,
29
29
  stop_after_attempt,
@@ -39,14 +39,10 @@ from prediction_market_agent_tooling.markets.omen.cow_contracts import (
39
39
  CowGPv2SettlementContract,
40
40
  )
41
41
  from prediction_market_agent_tooling.tools.contract import ContractERC20OnGnosisChain
42
+ from prediction_market_agent_tooling.tools.cow.models import MinimalisticToken, Order
42
43
  from prediction_market_agent_tooling.tools.utils import check_not_none, utcnow
43
44
 
44
45
 
45
- class MinimalisticToken(BaseModel):
46
- sellToken: ChecksumAddress
47
- buyToken: ChecksumAddress
48
-
49
-
50
46
  class OrderStatusError(Exception):
51
47
  pass
52
48
 
@@ -292,3 +288,38 @@ def get_trades_by_owner(
292
288
  )
293
289
  response.raise_for_status()
294
290
  return [MinimalisticToken.model_validate(i) for i in response.json()]
291
+
292
+
293
+ @tenacity.retry(
294
+ stop=stop_after_attempt(3),
295
+ wait=wait_fixed(1),
296
+ after=lambda x: logger.debug(f"get_orders_by_owner failed, {x.attempt_number=}."),
297
+ )
298
+ def get_orders_by_owner(
299
+ owner: ChecksumAddress,
300
+ ) -> list[Order]:
301
+ """Retrieves all orders with pagination."""
302
+ items = paginate_endpoint(f"https://api.cow.fi/xdai/api/v1/account/{owner}/orders")
303
+ return [Order.model_validate(i) for i in items]
304
+
305
+
306
+ @tenacity.retry(
307
+ stop=stop_after_attempt(3),
308
+ wait=wait_fixed(1),
309
+ after=lambda x: logger.debug(f"paginate_endpoint failed, {x.attempt_number=}."),
310
+ )
311
+ def paginate_endpoint(url: str, limit: int = 1000) -> t.Any:
312
+ offset = 0
313
+ results = []
314
+
315
+ while True:
316
+ response = httpx.get(url, params={"offset": offset, "limit": limit})
317
+ response.raise_for_status()
318
+ items = response.json()
319
+ if not items:
320
+ break
321
+
322
+ results.extend(items)
323
+ offset += limit
324
+
325
+ return results
@@ -0,0 +1,16 @@
1
+ from pydantic import BaseModel
2
+
3
+ from prediction_market_agent_tooling.gtypes import ChecksumAddress
4
+ from prediction_market_agent_tooling.tools.datetime_utc import DatetimeUTC
5
+
6
+
7
+ class MinimalisticToken(BaseModel):
8
+ sellToken: ChecksumAddress
9
+ buyToken: ChecksumAddress
10
+
11
+
12
+ class Order(BaseModel):
13
+ uid: str
14
+ sellToken: str
15
+ buyToken: str
16
+ creationDate: DatetimeUTC
@@ -9,6 +9,7 @@ import requests
9
9
  from pydantic import BaseModel, ValidationError
10
10
  from scipy.optimize import newton
11
11
  from scipy.stats import entropy
12
+ from tenacity import RetryError
12
13
 
13
14
  from prediction_market_agent_tooling.gtypes import (
14
15
  CollateralToken,
@@ -230,3 +231,12 @@ def calculate_sell_amount_in_collateral(
230
231
 
231
232
  amount_to_sell = newton(f, 0)
232
233
  return CollateralToken(float(amount_to_sell) * 0.999999) # Avoid rounding errors
234
+
235
+
236
+ def extract_error_from_retry_error(e: BaseException | RetryError) -> BaseException:
237
+ if (
238
+ isinstance(e, RetryError)
239
+ and (exp_from_retry := e.last_attempt.exception()) is not None
240
+ ):
241
+ e = exp_from_retry
242
+ return e
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "prediction-market-agent-tooling"
3
- version = "0.65.7"
3
+ version = "0.65.9"
4
4
  description = "Tools to benchmark, deploy and monitor prediction market agents."
5
5
  authors = ["Gnosis"]
6
6
  readme = "README.md"
@@ -1,10 +0,0 @@
1
- import typing as t
2
-
3
- from prediction_market_agent_tooling.gtypes import OutcomeStr
4
- from prediction_market_agent_tooling.markets.data_models import Resolution
5
-
6
-
7
- def validate_resolution(v: t.Any) -> Resolution:
8
- if isinstance(v, str):
9
- return Resolution(outcome=OutcomeStr(v), invalid=False)
10
- raise ValueError(f"Expected a string, got {v} {type(v)}")