prediction-market-agent-tooling 0.59.0.dev399__py3-none-any.whl → 0.59.2__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/deploy/agent.py +12 -2
- prediction_market_agent_tooling/tools/cow/cow_order.py +6 -0
- prediction_market_agent_tooling/tools/web3_utils.py +4 -2
- {prediction_market_agent_tooling-0.59.0.dev399.dist-info → prediction_market_agent_tooling-0.59.2.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.59.0.dev399.dist-info → prediction_market_agent_tooling-0.59.2.dist-info}/RECORD +8 -8
- {prediction_market_agent_tooling-0.59.0.dev399.dist-info → prediction_market_agent_tooling-0.59.2.dist-info}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.59.0.dev399.dist-info → prediction_market_agent_tooling-0.59.2.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.59.0.dev399.dist-info → prediction_market_agent_tooling-0.59.2.dist-info}/entry_points.txt +0 -0
@@ -619,11 +619,19 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
619
619
|
existing_position=existing_position,
|
620
620
|
)
|
621
621
|
|
622
|
+
# 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.
|
623
|
+
# 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.
|
624
|
+
still_tradeable = market.can_be_traded()
|
625
|
+
if not still_tradeable:
|
626
|
+
logger.warning(
|
627
|
+
f"Market {market.question=} ({market.url}) was selected to processing, but is not tradeable anymore."
|
628
|
+
)
|
629
|
+
|
622
630
|
placed_trades = []
|
623
631
|
for trade in trades:
|
624
632
|
logger.info(f"Executing trade {trade} on market {market.id} ({market.url})")
|
625
633
|
|
626
|
-
if self.place_trades:
|
634
|
+
if self.place_trades and still_tradeable:
|
627
635
|
match trade.trade_type:
|
628
636
|
case TradeType.BUY:
|
629
637
|
id = market.buy_tokens(
|
@@ -637,7 +645,9 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
637
645
|
raise ValueError(f"Unexpected trade type {trade.trade_type}.")
|
638
646
|
placed_trades.append(PlacedTrade.from_trade(trade, id))
|
639
647
|
else:
|
640
|
-
logger.info(
|
648
|
+
logger.info(
|
649
|
+
f"Trade execution skipped because, {self.place_trades=} or {still_tradeable=}."
|
650
|
+
)
|
641
651
|
|
642
652
|
traded_market = ProcessedTradedMarket(
|
643
653
|
answer=processed_market.answer, trades=placed_trades
|
@@ -2,6 +2,7 @@ import asyncio
|
|
2
2
|
from datetime import timedelta
|
3
3
|
|
4
4
|
import httpx
|
5
|
+
import tenacity
|
5
6
|
from cowdao_cowpy import swap_tokens
|
6
7
|
from cowdao_cowpy.common.chains import Chain
|
7
8
|
from cowdao_cowpy.common.config import SupportedChainId
|
@@ -34,6 +35,11 @@ def get_order_book_api(env: Envs, chain: Chain) -> OrderBookApi:
|
|
34
35
|
return OrderBookApi(OrderBookAPIConfigFactory.get_config(env, chain_id))
|
35
36
|
|
36
37
|
|
38
|
+
@tenacity.retry(
|
39
|
+
stop=tenacity.stop_after_attempt(3),
|
40
|
+
wait=tenacity.wait_fixed(1),
|
41
|
+
after=lambda x: logger.debug(f"get_buy_token_amount failed, {x.attempt_number=}."),
|
42
|
+
)
|
37
43
|
def get_buy_token_amount(
|
38
44
|
amount_wei: Wei,
|
39
45
|
sell_token: ChecksumAddress,
|
@@ -164,7 +164,8 @@ def _prepare_tx_params(
|
|
164
164
|
|
165
165
|
@tenacity.retry(
|
166
166
|
# Don't retry on `reverted` messages, as they would always fail again.
|
167
|
-
|
167
|
+
# TODO: Check this, see https://github.com/gnosis/prediction-market-agent-tooling/issues/625.
|
168
|
+
# retry=tenacity.retry_if_exception_message(match=NOT_REVERTED_ICASE_REGEX_PATTERN),
|
168
169
|
wait=tenacity.wait_chain(*[tenacity.wait_fixed(n) for n in range(1, 10)]),
|
169
170
|
stop=tenacity.stop_after_attempt(9),
|
170
171
|
after=lambda x: logger.debug(
|
@@ -201,7 +202,8 @@ def send_function_on_contract_tx(
|
|
201
202
|
|
202
203
|
@tenacity.retry(
|
203
204
|
# Don't retry on `reverted` messages, as they would always fail again.
|
204
|
-
|
205
|
+
# TODO: Check this, see https://github.com/gnosis/prediction-market-agent-tooling/issues/625.
|
206
|
+
# retry=tenacity.retry_if_exception_message(match=NOT_REVERTED_ICASE_REGEX_PATTERN),
|
205
207
|
wait=tenacity.wait_chain(*[tenacity.wait_fixed(n) for n in range(1, 10)]),
|
206
208
|
stop=tenacity.stop_after_attempt(5),
|
207
209
|
after=lambda x: logger.debug(
|
@@ -21,7 +21,7 @@ prediction_market_agent_tooling/benchmark/agents.py,sha256=B1-uWdyeN4GGKMWGK_-Cc
|
|
21
21
|
prediction_market_agent_tooling/benchmark/benchmark.py,sha256=MqTiaaJ3cYiOLUVR7OyImLWxcEya3Rl5JyFYW-K0lwM,17097
|
22
22
|
prediction_market_agent_tooling/benchmark/utils.py,sha256=D0MfUkVZllmvcU0VOurk9tcKT7JTtwwOp-63zuCBVuc,2880
|
23
23
|
prediction_market_agent_tooling/config.py,sha256=owJ3goDbH1aeX8PzeJCeGK5pitYJqqk7yFOkaTbDarY,9209
|
24
|
-
prediction_market_agent_tooling/deploy/agent.py,sha256=
|
24
|
+
prediction_market_agent_tooling/deploy/agent.py,sha256=rvBPubAjZu9WACayT4q4ERxINOayBJte9ZPi7yFlnNQ,24872
|
25
25
|
prediction_market_agent_tooling/deploy/agent_example.py,sha256=dIIdZashExWk9tOdyDjw87AuUcGyM7jYxNChYrVK2dM,1001
|
26
26
|
prediction_market_agent_tooling/deploy/betting_strategy.py,sha256=Y6Pb8OfSb6galRbfdNBvvNTgO-4dR2ybJ4o5GKJcMoM,12894
|
27
27
|
prediction_market_agent_tooling/deploy/constants.py,sha256=M5ty8URipYMGe_G-RzxRydK3AFL6CyvmqCraJUrLBnE,82
|
@@ -86,7 +86,7 @@ prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp
|
|
86
86
|
prediction_market_agent_tooling/tools/contract.py,sha256=gmSuANqlfwldFG7hc4uom0q1Z-mo40qfYh5TDUKLFTs,20518
|
87
87
|
prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
|
88
88
|
prediction_market_agent_tooling/tools/cow/cow_manager.py,sha256=WK6Uk722VotjLHtxDPHxvwBrWVb3rvTegg_3w58ehwU,3869
|
89
|
-
prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=
|
89
|
+
prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=M3zQohgAzy_LETnf9rKtS1L9rr7FP92CH6v0G2laZkM,4435
|
90
90
|
prediction_market_agent_tooling/tools/custom_exceptions.py,sha256=Fh8z1fbwONvP4-j7AmV_PuEcoqb6-QXa9PJ9m7guMcM,93
|
91
91
|
prediction_market_agent_tooling/tools/datetime_utc.py,sha256=8_WackjtjC8zHXrhQFTGQ6e6Fz_6llWoKR4CSFvIv9I,2766
|
92
92
|
prediction_market_agent_tooling/tools/db/db_manager.py,sha256=GtzHH1NLl8HwqC8Z7s6eTlIQXuV0blxfaV2PeQrBnfQ,3013
|
@@ -116,9 +116,9 @@ prediction_market_agent_tooling/tools/tokens/auto_withdraw.py,sha256=B02maQkl3wN
|
|
116
116
|
prediction_market_agent_tooling/tools/tokens/main_token.py,sha256=5iHO7-iehSlXuue6ocVrr4IsklVjm7QHIwln4BsebJA,573
|
117
117
|
prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
|
118
118
|
prediction_market_agent_tooling/tools/utils.py,sha256=jLG4nbEoIzzJiZ4RgMx4Q969Zdl0p0s63p8uET_0Fuw,6440
|
119
|
-
prediction_market_agent_tooling/tools/web3_utils.py,sha256=
|
120
|
-
prediction_market_agent_tooling-0.59.
|
121
|
-
prediction_market_agent_tooling-0.59.
|
122
|
-
prediction_market_agent_tooling-0.59.
|
123
|
-
prediction_market_agent_tooling-0.59.
|
124
|
-
prediction_market_agent_tooling-0.59.
|
119
|
+
prediction_market_agent_tooling/tools/web3_utils.py,sha256=2PXZfGRrDVZD60agVpBN4JkOF0YsNBXgTEH1y-V71uQ,12723
|
120
|
+
prediction_market_agent_tooling-0.59.2.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
121
|
+
prediction_market_agent_tooling-0.59.2.dist-info/METADATA,sha256=MqNzGgXLVbHhIWejKukTi6hRsjK0nr5TRbax5iiyLn8,8629
|
122
|
+
prediction_market_agent_tooling-0.59.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
123
|
+
prediction_market_agent_tooling-0.59.2.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
124
|
+
prediction_market_agent_tooling-0.59.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|