prediction-market-agent-tooling 0.67.1__tar.gz → 0.67.3__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.
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/PKG-INFO +2 -1
- prediction_market_agent_tooling-0.67.3/prediction_market_agent_tooling/abis/erc1155.abi.json +352 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/deploy/agent.py +109 -47
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/deploy/betting_strategy.py +1 -1
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/agent_market.py +16 -3
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/manifold/manifold.py +4 -3
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/markets.py +6 -5
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/metaculus/metaculus.py +4 -3
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/omen/omen.py +5 -4
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/polymarket/polymarket.py +5 -4
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/seer/data_models.py +30 -8
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/seer/seer.py +79 -20
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/seer/seer_contracts.py +18 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py +149 -20
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/seer/subgraph_data_models.py +0 -4
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/seer/swap_pool_handler.py +0 -10
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/contract.py +59 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/cow/cow_order.py +4 -1
- prediction_market_agent_tooling-0.67.3/prediction_market_agent_tooling/tools/rephrase.py +71 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/tokens/auto_deposit.py +57 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/pyproject.toml +2 -1
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/README.md +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/agentresultmapping.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/debuggingcontract.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/depositablewrapper_erc20.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/erc20.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/erc4626.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/erc721.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/gvp2_settlement.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/omen_dxdao.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/omen_fpmm.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/omen_fpmm_conditionaltokens.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/omen_fpmm_factory.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/omen_kleros.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/omen_oracle.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/omen_realitio.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/omen_thumbnailmapping.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/ownable.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/ownable_erc721.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/proxy.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/seer_gnosis_router.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/seer_market_factory.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/abis/swapr_router.abi.json +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/benchmark/__init__.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/benchmark/agents.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/benchmark/benchmark.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/benchmark/utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/chains.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/config.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/data_download/langfuse_data_downloader.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/deploy/agent_example.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/deploy/constants.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/deploy/gcp/deploy.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/deploy/gcp/kubernetes_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/deploy/gcp/utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/deploy/trade_interval.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/gtypes.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/jobs/__init__.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/jobs/jobs_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/jobs/omen/omen_jobs.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/loggers.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/logprobs_parser.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/base_subgraph_handler.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/blockchain_utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/categorize.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/data_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/manifold/__init__.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/manifold/api.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/manifold/data_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/manifold/utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/market_fees.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/metaculus/api.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/metaculus/data_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/omen/__init__.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/omen/cow_contracts.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/omen/data_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/omen/omen_constants.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/omen/omen_contracts.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/omen/omen_resolving.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/polymarket/api.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/polymarket/data_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/polymarket/data_models_web.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/polymarket/polymarket_subgraph_handler.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/polymarket/utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/seer/exceptions.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/markets/seer/price_manager.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/py.typed +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/_generic_value.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/balances.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/betting_strategies/kelly_criterion.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/betting_strategies/stretch_bet_between.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/betting_strategies/utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/caches/db_cache.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/caches/inmemory_cache.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/caches/serializers.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/costs.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/cow/models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/cow/semaphore.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/custom_exceptions.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/datetime_utc.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/db/db_manager.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/google_utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/hexbytes_custom.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/httpx_cached_client.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/image_gen/image_gen.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/image_gen/market_thumbnail_gen.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/ipfs/ipfs_handler.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/is_invalid.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/is_predictable.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/langfuse_.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/langfuse_client_utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/omen/reality_accuracy.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/omen/sell_positions.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/parallelism.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/perplexity/perplexity_client.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/perplexity/perplexity_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/perplexity/perplexity_search.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/relevant_news_analysis/data_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_analysis.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_cache.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/safe.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/singleton.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/streamlit_user_login.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/tavily/tavily_models.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/tavily/tavily_search.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/tokens/auto_withdraw.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/tokens/main_token.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/tokens/slippage.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/tokens/token_utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/tokens/usd.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/transaction_cache.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/prediction_market_agent_tooling/tools/utils.py +0 -0
- {prediction_market_agent_tooling-0.67.1 → prediction_market_agent_tooling-0.67.3}/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.67.
|
3
|
+
Version: 0.67.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
|
@@ -42,6 +42,7 @@ Requires-Dist: proto-plus (>=1.0.0,<2.0.0)
|
|
42
42
|
Requires-Dist: protobuf (>=5.0.0,<6.0.0)
|
43
43
|
Requires-Dist: psycopg2-binary (>=2.9.9,<3.0.0)
|
44
44
|
Requires-Dist: pydantic (>=2.6.1,<3.0.0)
|
45
|
+
Requires-Dist: pydantic-ai (>=0.1.9,<1.0.0)
|
45
46
|
Requires-Dist: pydantic-settings (>=2.4.0,<3.0.0)
|
46
47
|
Requires-Dist: pymongo (>=4.8.0,<5.0.0)
|
47
48
|
Requires-Dist: pytest-postgresql (>=6.1.1,<7.0.0)
|
@@ -0,0 +1,352 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"inputs": [],
|
4
|
+
"stateMutability": "nonpayable",
|
5
|
+
"type": "constructor"
|
6
|
+
},
|
7
|
+
{
|
8
|
+
"anonymous": false,
|
9
|
+
"inputs": [
|
10
|
+
{
|
11
|
+
"indexed": true,
|
12
|
+
"internalType": "address",
|
13
|
+
"name": "owner",
|
14
|
+
"type": "address"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"indexed": true,
|
18
|
+
"internalType": "address",
|
19
|
+
"name": "spender",
|
20
|
+
"type": "address"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"indexed": false,
|
24
|
+
"internalType": "uint256",
|
25
|
+
"name": "value",
|
26
|
+
"type": "uint256"
|
27
|
+
}
|
28
|
+
],
|
29
|
+
"name": "Approval",
|
30
|
+
"type": "event"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"anonymous": false,
|
34
|
+
"inputs": [
|
35
|
+
{
|
36
|
+
"indexed": true,
|
37
|
+
"internalType": "address",
|
38
|
+
"name": "from",
|
39
|
+
"type": "address"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"indexed": true,
|
43
|
+
"internalType": "address",
|
44
|
+
"name": "to",
|
45
|
+
"type": "address"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"indexed": false,
|
49
|
+
"internalType": "uint256",
|
50
|
+
"name": "value",
|
51
|
+
"type": "uint256"
|
52
|
+
}
|
53
|
+
],
|
54
|
+
"name": "Transfer",
|
55
|
+
"type": "event"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"inputs": [
|
59
|
+
{
|
60
|
+
"internalType": "address",
|
61
|
+
"name": "owner",
|
62
|
+
"type": "address"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"internalType": "address",
|
66
|
+
"name": "spender",
|
67
|
+
"type": "address"
|
68
|
+
}
|
69
|
+
],
|
70
|
+
"name": "allowance",
|
71
|
+
"outputs": [
|
72
|
+
{
|
73
|
+
"internalType": "uint256",
|
74
|
+
"name": "",
|
75
|
+
"type": "uint256"
|
76
|
+
}
|
77
|
+
],
|
78
|
+
"stateMutability": "view",
|
79
|
+
"type": "function"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"inputs": [
|
83
|
+
{
|
84
|
+
"internalType": "address",
|
85
|
+
"name": "spender",
|
86
|
+
"type": "address"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"internalType": "uint256",
|
90
|
+
"name": "amount",
|
91
|
+
"type": "uint256"
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"name": "approve",
|
95
|
+
"outputs": [
|
96
|
+
{
|
97
|
+
"internalType": "bool",
|
98
|
+
"name": "",
|
99
|
+
"type": "bool"
|
100
|
+
}
|
101
|
+
],
|
102
|
+
"stateMutability": "nonpayable",
|
103
|
+
"type": "function"
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"inputs": [
|
107
|
+
{
|
108
|
+
"internalType": "address",
|
109
|
+
"name": "account",
|
110
|
+
"type": "address"
|
111
|
+
}
|
112
|
+
],
|
113
|
+
"name": "balanceOf",
|
114
|
+
"outputs": [
|
115
|
+
{
|
116
|
+
"internalType": "uint256",
|
117
|
+
"name": "",
|
118
|
+
"type": "uint256"
|
119
|
+
}
|
120
|
+
],
|
121
|
+
"stateMutability": "view",
|
122
|
+
"type": "function"
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"inputs": [
|
126
|
+
{
|
127
|
+
"internalType": "address",
|
128
|
+
"name": "account",
|
129
|
+
"type": "address"
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"internalType": "uint256",
|
133
|
+
"name": "amount",
|
134
|
+
"type": "uint256"
|
135
|
+
}
|
136
|
+
],
|
137
|
+
"name": "burn",
|
138
|
+
"outputs": [],
|
139
|
+
"stateMutability": "nonpayable",
|
140
|
+
"type": "function"
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"inputs": [],
|
144
|
+
"name": "decimals",
|
145
|
+
"outputs": [
|
146
|
+
{
|
147
|
+
"internalType": "uint8",
|
148
|
+
"name": "",
|
149
|
+
"type": "uint8"
|
150
|
+
}
|
151
|
+
],
|
152
|
+
"stateMutability": "view",
|
153
|
+
"type": "function"
|
154
|
+
},
|
155
|
+
{
|
156
|
+
"inputs": [
|
157
|
+
{
|
158
|
+
"internalType": "address",
|
159
|
+
"name": "spender",
|
160
|
+
"type": "address"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"internalType": "uint256",
|
164
|
+
"name": "subtractedValue",
|
165
|
+
"type": "uint256"
|
166
|
+
}
|
167
|
+
],
|
168
|
+
"name": "decreaseAllowance",
|
169
|
+
"outputs": [
|
170
|
+
{
|
171
|
+
"internalType": "bool",
|
172
|
+
"name": "",
|
173
|
+
"type": "bool"
|
174
|
+
}
|
175
|
+
],
|
176
|
+
"stateMutability": "nonpayable",
|
177
|
+
"type": "function"
|
178
|
+
},
|
179
|
+
{
|
180
|
+
"inputs": [],
|
181
|
+
"name": "factory",
|
182
|
+
"outputs": [
|
183
|
+
{
|
184
|
+
"internalType": "contract Wrapped1155Factory",
|
185
|
+
"name": "",
|
186
|
+
"type": "address"
|
187
|
+
}
|
188
|
+
],
|
189
|
+
"stateMutability": "view",
|
190
|
+
"type": "function"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"inputs": [
|
194
|
+
{
|
195
|
+
"internalType": "address",
|
196
|
+
"name": "spender",
|
197
|
+
"type": "address"
|
198
|
+
},
|
199
|
+
{
|
200
|
+
"internalType": "uint256",
|
201
|
+
"name": "addedValue",
|
202
|
+
"type": "uint256"
|
203
|
+
}
|
204
|
+
],
|
205
|
+
"name": "increaseAllowance",
|
206
|
+
"outputs": [
|
207
|
+
{
|
208
|
+
"internalType": "bool",
|
209
|
+
"name": "",
|
210
|
+
"type": "bool"
|
211
|
+
}
|
212
|
+
],
|
213
|
+
"stateMutability": "nonpayable",
|
214
|
+
"type": "function"
|
215
|
+
},
|
216
|
+
{
|
217
|
+
"inputs": [
|
218
|
+
{
|
219
|
+
"internalType": "address",
|
220
|
+
"name": "account",
|
221
|
+
"type": "address"
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"internalType": "uint256",
|
225
|
+
"name": "amount",
|
226
|
+
"type": "uint256"
|
227
|
+
}
|
228
|
+
],
|
229
|
+
"name": "mint",
|
230
|
+
"outputs": [],
|
231
|
+
"stateMutability": "nonpayable",
|
232
|
+
"type": "function"
|
233
|
+
},
|
234
|
+
{
|
235
|
+
"inputs": [],
|
236
|
+
"name": "multiToken",
|
237
|
+
"outputs": [
|
238
|
+
{
|
239
|
+
"internalType": "contract IERC1155",
|
240
|
+
"name": "",
|
241
|
+
"type": "address"
|
242
|
+
}
|
243
|
+
],
|
244
|
+
"stateMutability": "view",
|
245
|
+
"type": "function"
|
246
|
+
},
|
247
|
+
{
|
248
|
+
"inputs": [],
|
249
|
+
"name": "name",
|
250
|
+
"outputs": [
|
251
|
+
{
|
252
|
+
"internalType": "string",
|
253
|
+
"name": "",
|
254
|
+
"type": "string"
|
255
|
+
}
|
256
|
+
],
|
257
|
+
"stateMutability": "view",
|
258
|
+
"type": "function"
|
259
|
+
},
|
260
|
+
{
|
261
|
+
"inputs": [],
|
262
|
+
"name": "symbol",
|
263
|
+
"outputs": [
|
264
|
+
{
|
265
|
+
"internalType": "string",
|
266
|
+
"name": "",
|
267
|
+
"type": "string"
|
268
|
+
}
|
269
|
+
],
|
270
|
+
"stateMutability": "view",
|
271
|
+
"type": "function"
|
272
|
+
},
|
273
|
+
{
|
274
|
+
"inputs": [],
|
275
|
+
"name": "tokenId",
|
276
|
+
"outputs": [
|
277
|
+
{
|
278
|
+
"internalType": "uint256",
|
279
|
+
"name": "",
|
280
|
+
"type": "uint256"
|
281
|
+
}
|
282
|
+
],
|
283
|
+
"stateMutability": "view",
|
284
|
+
"type": "function"
|
285
|
+
},
|
286
|
+
{
|
287
|
+
"inputs": [],
|
288
|
+
"name": "totalSupply",
|
289
|
+
"outputs": [
|
290
|
+
{
|
291
|
+
"internalType": "uint256",
|
292
|
+
"name": "",
|
293
|
+
"type": "uint256"
|
294
|
+
}
|
295
|
+
],
|
296
|
+
"stateMutability": "view",
|
297
|
+
"type": "function"
|
298
|
+
},
|
299
|
+
{
|
300
|
+
"inputs": [
|
301
|
+
{
|
302
|
+
"internalType": "address",
|
303
|
+
"name": "recipient",
|
304
|
+
"type": "address"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
"internalType": "uint256",
|
308
|
+
"name": "amount",
|
309
|
+
"type": "uint256"
|
310
|
+
}
|
311
|
+
],
|
312
|
+
"name": "transfer",
|
313
|
+
"outputs": [
|
314
|
+
{
|
315
|
+
"internalType": "bool",
|
316
|
+
"name": "",
|
317
|
+
"type": "bool"
|
318
|
+
}
|
319
|
+
],
|
320
|
+
"stateMutability": "nonpayable",
|
321
|
+
"type": "function"
|
322
|
+
},
|
323
|
+
{
|
324
|
+
"inputs": [
|
325
|
+
{
|
326
|
+
"internalType": "address",
|
327
|
+
"name": "sender",
|
328
|
+
"type": "address"
|
329
|
+
},
|
330
|
+
{
|
331
|
+
"internalType": "address",
|
332
|
+
"name": "recipient",
|
333
|
+
"type": "address"
|
334
|
+
},
|
335
|
+
{
|
336
|
+
"internalType": "uint256",
|
337
|
+
"name": "amount",
|
338
|
+
"type": "uint256"
|
339
|
+
}
|
340
|
+
],
|
341
|
+
"name": "transferFrom",
|
342
|
+
"outputs": [
|
343
|
+
{
|
344
|
+
"internalType": "bool",
|
345
|
+
"name": "",
|
346
|
+
"type": "bool"
|
347
|
+
}
|
348
|
+
],
|
349
|
+
"stateMutability": "nonpayable",
|
350
|
+
"type": "function"
|
351
|
+
}
|
352
|
+
]
|
@@ -6,6 +6,7 @@ from enum import Enum
|
|
6
6
|
from functools import cached_property
|
7
7
|
|
8
8
|
from pydantic import computed_field
|
9
|
+
from pydantic_ai.exceptions import UnexpectedModelBehavior
|
9
10
|
|
10
11
|
from prediction_market_agent_tooling.config import APIKeys
|
11
12
|
from prediction_market_agent_tooling.deploy.betting_strategy import (
|
@@ -19,13 +20,13 @@ from prediction_market_agent_tooling.deploy.trade_interval import (
|
|
19
20
|
)
|
20
21
|
from prediction_market_agent_tooling.gtypes import USD, OutcomeToken, xDai
|
21
22
|
from prediction_market_agent_tooling.loggers import logger
|
22
|
-
from prediction_market_agent_tooling.markets.agent_market import AgentMarket, FilterBy
|
23
|
-
from prediction_market_agent_tooling.markets.agent_market import (
|
24
|
-
MarketType as AgentMarketType,
|
25
|
-
)
|
26
23
|
from prediction_market_agent_tooling.markets.agent_market import (
|
24
|
+
AgentMarket,
|
25
|
+
ConditionalFilterType,
|
26
|
+
FilterBy,
|
27
27
|
ProcessedMarket,
|
28
28
|
ProcessedTradedMarket,
|
29
|
+
QuestionType,
|
29
30
|
SortBy,
|
30
31
|
)
|
31
32
|
from prediction_market_agent_tooling.markets.data_models import (
|
@@ -47,6 +48,9 @@ from prediction_market_agent_tooling.tools.custom_exceptions import (
|
|
47
48
|
from prediction_market_agent_tooling.tools.is_invalid import is_invalid
|
48
49
|
from prediction_market_agent_tooling.tools.is_predictable import is_predictable_binary
|
49
50
|
from prediction_market_agent_tooling.tools.langfuse_ import langfuse_context, observe
|
51
|
+
from prediction_market_agent_tooling.tools.rephrase import (
|
52
|
+
rephrase_question_to_unconditional,
|
53
|
+
)
|
50
54
|
from prediction_market_agent_tooling.tools.tokens.main_token import (
|
51
55
|
MINIMUM_NATIVE_TOKEN_IN_EOA_FOR_FEES,
|
52
56
|
)
|
@@ -196,6 +200,7 @@ class DeployablePredictionAgent(DeployableAgent):
|
|
196
200
|
trade_on_markets_created_after: DatetimeUTC | None = None
|
197
201
|
get_markets_sort_by: SortBy = SortBy.CLOSING_SOONEST
|
198
202
|
get_markets_filter_by: FilterBy = FilterBy.OPEN
|
203
|
+
rephrase_conditional_markets: bool = True
|
199
204
|
|
200
205
|
# Agent behaviour when filtering fetched markets
|
201
206
|
allow_invalid_questions: bool = False
|
@@ -205,6 +210,8 @@ class DeployablePredictionAgent(DeployableAgent):
|
|
205
210
|
MINIMUM_NATIVE_TOKEN_IN_EOA_FOR_FEES
|
206
211
|
)
|
207
212
|
|
213
|
+
just_warn_on_unexpected_model_behavior: bool = False
|
214
|
+
|
208
215
|
# Only Metaculus allows to post predictions without trading (buying/selling of outcome tokens).
|
209
216
|
supported_markets: t.Sequence[MarketType] = [MarketType.METACULUS]
|
210
217
|
|
@@ -224,6 +231,7 @@ class DeployablePredictionAgent(DeployableAgent):
|
|
224
231
|
self.answer_categorical_market = observe()(self.answer_categorical_market) # type: ignore[method-assign]
|
225
232
|
self.answer_scalar_market = observe()(self.answer_scalar_market) # type: ignore[method-assign]
|
226
233
|
self.process_market = observe()(self.process_market) # type: ignore[method-assign]
|
234
|
+
self.rephrase_market_to_unconditional = observe()(self.rephrase_market_to_unconditional) # type: ignore[method-assign]
|
227
235
|
|
228
236
|
def update_langfuse_trace_by_market(
|
229
237
|
self, market_type: MarketType, market: AgentMarket
|
@@ -298,6 +306,34 @@ class DeployablePredictionAgent(DeployableAgent):
|
|
298
306
|
|
299
307
|
return True
|
300
308
|
|
309
|
+
def rephrase_market_to_unconditional(
|
310
|
+
self,
|
311
|
+
market_: AgentMarket,
|
312
|
+
) -> AgentMarket:
|
313
|
+
"""
|
314
|
+
If `rephrase_conditional_markets` is set to True,
|
315
|
+
this method will be used to rephrase the question to account for the parent's market probability in the agent's decision process.
|
316
|
+
"""
|
317
|
+
new = market_.model_copy(deep=True)
|
318
|
+
|
319
|
+
if new.parent is not None and new.parent.market.parent is not None:
|
320
|
+
new.parent.market = self.rephrase_market_to_unconditional(new.parent.market)
|
321
|
+
|
322
|
+
rephrased_question = (
|
323
|
+
rephrase_question_to_unconditional(
|
324
|
+
new.question,
|
325
|
+
new.parent.market.question,
|
326
|
+
new.parent.market.outcomes[new.parent.parent_outcome],
|
327
|
+
)
|
328
|
+
if new.parent is not None
|
329
|
+
else new.question
|
330
|
+
)
|
331
|
+
|
332
|
+
new.question = rephrased_question
|
333
|
+
new.parent = None
|
334
|
+
|
335
|
+
return new
|
336
|
+
|
301
337
|
def answer_categorical_market(
|
302
338
|
self, market: AgentMarket
|
303
339
|
) -> CategoricalProbabilisticAnswer | None:
|
@@ -338,13 +374,19 @@ class DeployablePredictionAgent(DeployableAgent):
|
|
338
374
|
return False
|
339
375
|
|
340
376
|
@property
|
341
|
-
def
|
377
|
+
def conditional_filter_type(self) -> ConditionalFilterType:
|
378
|
+
if self.rephrase_conditional_markets:
|
379
|
+
return ConditionalFilterType.ALL
|
380
|
+
return ConditionalFilterType.ONLY_NOT_CONDITIONAL
|
381
|
+
|
382
|
+
@property
|
383
|
+
def agent_question_type(self) -> QuestionType:
|
342
384
|
if self.fetch_scalar_markets:
|
343
|
-
return
|
385
|
+
return QuestionType.SCALAR
|
344
386
|
elif self.fetch_categorical_markets:
|
345
|
-
return
|
387
|
+
return QuestionType.CATEGORICAL
|
346
388
|
else:
|
347
|
-
return
|
389
|
+
return QuestionType.BINARY
|
348
390
|
|
349
391
|
def get_markets(
|
350
392
|
self,
|
@@ -355,15 +397,14 @@ class DeployablePredictionAgent(DeployableAgent):
|
|
355
397
|
"""
|
356
398
|
cls = market_type.market_class
|
357
399
|
|
358
|
-
agent_market_type = self.agent_market_type
|
359
|
-
|
360
400
|
# Fetch the soonest closing markets to choose from
|
361
401
|
available_markets = cls.get_markets(
|
362
402
|
limit=self.n_markets_to_fetch,
|
363
403
|
sort_by=self.get_markets_sort_by,
|
364
404
|
filter_by=self.get_markets_filter_by,
|
365
405
|
created_after=self.trade_on_markets_created_after,
|
366
|
-
|
406
|
+
question_type=self.agent_question_type,
|
407
|
+
conditional_filter_type=self.conditional_filter_type,
|
367
408
|
)
|
368
409
|
return available_markets
|
369
410
|
|
@@ -396,6 +437,9 @@ class DeployablePredictionAgent(DeployableAgent):
|
|
396
437
|
|
397
438
|
logger.info(f"Answering market '{market.question}'.")
|
398
439
|
|
440
|
+
if self.rephrase_conditional_markets and market.parent is not None:
|
441
|
+
market = self.rephrase_market_to_unconditional(market)
|
442
|
+
|
399
443
|
if market.is_binary:
|
400
444
|
try:
|
401
445
|
binary_answer = self.answer_binary_market(market)
|
@@ -455,9 +499,18 @@ class DeployablePredictionAgent(DeployableAgent):
|
|
455
499
|
f"Processing market {market.question=} from {market.url=} with liquidity {market.get_liquidity()}."
|
456
500
|
)
|
457
501
|
|
458
|
-
|
459
|
-
|
460
|
-
|
502
|
+
try:
|
503
|
+
answer = self.build_answer(
|
504
|
+
market=market, market_type=market_type, verify_market=verify_market
|
505
|
+
)
|
506
|
+
except UnexpectedModelBehavior:
|
507
|
+
(
|
508
|
+
logger.warning
|
509
|
+
if self.just_warn_on_unexpected_model_behavior
|
510
|
+
else logger.exception
|
511
|
+
)(f"Unexpected model behaviour in {self.__class__.__name__}.")
|
512
|
+
answer = None
|
513
|
+
|
461
514
|
if answer is not None:
|
462
515
|
self.verify_answer_outcomes(market=market, answer=answer)
|
463
516
|
|
@@ -577,6 +630,7 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
577
630
|
super().initialize_langfuse()
|
578
631
|
# Auto-observe all the methods where it makes sense, so that subclassses don't need to do it manually.
|
579
632
|
self.build_trades = observe()(self.build_trades) # type: ignore[method-assign]
|
633
|
+
self.execute_trades = observe()(self.execute_trades) # type: ignore[method-assign]
|
580
634
|
|
581
635
|
def check_min_required_balance_to_trade(self, market: AgentMarket) -> None:
|
582
636
|
api_keys = APIKeys()
|
@@ -622,37 +676,9 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
622
676
|
trades = strategy.calculate_trades(existing_position, answer, market)
|
623
677
|
return trades
|
624
678
|
|
625
|
-
def
|
626
|
-
self,
|
627
|
-
) ->
|
628
|
-
super().before_process_market(market_type, market)
|
629
|
-
self.check_min_required_balance_to_trade(market)
|
630
|
-
|
631
|
-
def process_market(
|
632
|
-
self,
|
633
|
-
market_type: MarketType,
|
634
|
-
market: AgentMarket,
|
635
|
-
verify_market: bool = True,
|
636
|
-
) -> ProcessedTradedMarket | None:
|
637
|
-
processed_market = super().process_market(market_type, market, verify_market)
|
638
|
-
if processed_market is None:
|
639
|
-
return None
|
640
|
-
|
641
|
-
api_keys = APIKeys()
|
642
|
-
user_id = market.get_user_id(api_keys=api_keys)
|
643
|
-
|
644
|
-
try:
|
645
|
-
existing_position = market.get_position(user_id=user_id)
|
646
|
-
except Exception as e:
|
647
|
-
logger.warning(f"Could not get position for user {user_id}, exception {e}")
|
648
|
-
return None
|
649
|
-
|
650
|
-
trades = self.build_trades(
|
651
|
-
market=market,
|
652
|
-
answer=processed_market.answer,
|
653
|
-
existing_position=existing_position,
|
654
|
-
)
|
655
|
-
|
679
|
+
def execute_trades(
|
680
|
+
self, market: AgentMarket, trades: list[Trade]
|
681
|
+
) -> list[PlacedTrade]:
|
656
682
|
# It can take quite some time before agent processes all the markets, recheck here if the market didn't get closed in the meantime, to not error out completely.
|
657
683
|
# Unfortunately, we can not just add some room into closing time of the market while fetching them, because liquidity can be removed at any time by the liquidity providers.
|
658
684
|
still_tradeable = market.can_be_traded()
|
@@ -661,7 +687,8 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
661
687
|
f"Market {market.question=} ({market.url}) was selected to processing, but is not tradeable anymore."
|
662
688
|
)
|
663
689
|
|
664
|
-
placed_trades = []
|
690
|
+
placed_trades: list[PlacedTrade] = []
|
691
|
+
|
665
692
|
for trade in trades:
|
666
693
|
logger.info(f"Executing trade {trade} on market {market.id} ({market.url})")
|
667
694
|
|
@@ -674,7 +701,9 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
674
701
|
case TradeType.SELL:
|
675
702
|
# Get actual value of the position we are going to sell, and if it's less than we wanted to sell, simply sell all of it.
|
676
703
|
current_position = check_not_none(
|
677
|
-
market.get_position(
|
704
|
+
market.get_position(
|
705
|
+
market.get_user_id(api_keys=self.api_keys)
|
706
|
+
),
|
678
707
|
"Should exists if we are going to sell outcomes.",
|
679
708
|
)
|
680
709
|
|
@@ -702,6 +731,39 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
702
731
|
f"Trade execution skipped because, {self.place_trades=} or {still_tradeable=}."
|
703
732
|
)
|
704
733
|
|
734
|
+
return placed_trades
|
735
|
+
|
736
|
+
def before_process_market(
|
737
|
+
self, market_type: MarketType, market: AgentMarket
|
738
|
+
) -> None:
|
739
|
+
super().before_process_market(market_type, market)
|
740
|
+
self.check_min_required_balance_to_trade(market)
|
741
|
+
|
742
|
+
def process_market(
|
743
|
+
self,
|
744
|
+
market_type: MarketType,
|
745
|
+
market: AgentMarket,
|
746
|
+
verify_market: bool = True,
|
747
|
+
) -> ProcessedTradedMarket | None:
|
748
|
+
processed_market = super().process_market(market_type, market, verify_market)
|
749
|
+
if processed_market is None:
|
750
|
+
return None
|
751
|
+
|
752
|
+
user_id = market.get_user_id(api_keys=self.api_keys)
|
753
|
+
|
754
|
+
try:
|
755
|
+
existing_position = market.get_position(user_id=user_id)
|
756
|
+
except Exception as e:
|
757
|
+
logger.warning(f"Could not get position for user {user_id}, exception {e}")
|
758
|
+
return None
|
759
|
+
|
760
|
+
trades = self.build_trades(
|
761
|
+
market=market,
|
762
|
+
answer=processed_market.answer,
|
763
|
+
existing_position=existing_position,
|
764
|
+
)
|
765
|
+
placed_trades = self.execute_trades(market, trades)
|
766
|
+
|
705
767
|
traded_market = ProcessedTradedMarket(
|
706
768
|
answer=processed_market.answer, trades=placed_trades
|
707
769
|
)
|
@@ -84,7 +84,7 @@ class BettingStrategy(ABC):
|
|
84
84
|
|
85
85
|
if outcome_tokens_to_get_in_usd <= trade.amount:
|
86
86
|
raise GuaranteedLossError(
|
87
|
-
f"Trade {trade=} would result in guaranteed loss by getting only {outcome_tokens_to_get=}. Halting execution."
|
87
|
+
f"Trade {trade=} on market {market.url=} would result in guaranteed loss by getting only {outcome_tokens_to_get=}. Halting execution."
|
88
88
|
)
|
89
89
|
|
90
90
|
clean_trades.append(trade)
|
@@ -64,13 +64,24 @@ class FilterBy(str, Enum):
|
|
64
64
|
NONE = "none"
|
65
65
|
|
66
66
|
|
67
|
-
class
|
67
|
+
class ParentMarket(BaseModel):
|
68
|
+
market: "AgentMarket"
|
69
|
+
parent_outcome: int
|
70
|
+
|
71
|
+
|
72
|
+
class QuestionType(str, Enum):
|
68
73
|
ALL = "all"
|
69
74
|
CATEGORICAL = "categorical"
|
70
75
|
SCALAR = "scalar"
|
71
76
|
BINARY = "binary"
|
72
77
|
|
73
78
|
|
79
|
+
class ConditionalFilterType(Enum):
|
80
|
+
ALL = 1
|
81
|
+
ONLY_CONDITIONAL = 2
|
82
|
+
ONLY_NOT_CONDITIONAL = 3
|
83
|
+
|
84
|
+
|
74
85
|
class AgentMarket(BaseModel):
|
75
86
|
"""
|
76
87
|
Common market class that can be created from vendor specific markets.
|
@@ -96,6 +107,8 @@ class AgentMarket(BaseModel):
|
|
96
107
|
upper_bound: Wei | None = None
|
97
108
|
lower_bound: Wei | None = None
|
98
109
|
|
110
|
+
parent: ParentMarket | None = None
|
111
|
+
|
99
112
|
@field_validator("probabilities")
|
100
113
|
def validate_probabilities(
|
101
114
|
cls,
|
@@ -376,8 +389,8 @@ class AgentMarket(BaseModel):
|
|
376
389
|
filter_by: FilterBy = FilterBy.OPEN,
|
377
390
|
created_after: t.Optional[DatetimeUTC] = None,
|
378
391
|
excluded_questions: set[str] | None = None,
|
379
|
-
|
380
|
-
|
392
|
+
question_type: QuestionType = QuestionType.ALL,
|
393
|
+
conditional_filter_type: ConditionalFilterType = ConditionalFilterType.ONLY_NOT_CONDITIONAL,
|
381
394
|
) -> t.Sequence["AgentMarket"]:
|
382
395
|
raise NotImplementedError("Subclasses must implement this method")
|
383
396
|
|