prediction-market-agent-tooling 0.62.0.dev468__py3-none-any.whl → 0.62.0.dev470__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.
@@ -36,6 +36,11 @@ def get_order_book_api(env: Envs, chain: Chain) -> OrderBookApi:
36
36
  return OrderBookApi(OrderBookAPIConfigFactory.get_config(env, chain_id))
37
37
 
38
38
 
39
+ @tenacity.retry(
40
+ stop=tenacity.stop_after_attempt(3),
41
+ wait=tenacity.wait_fixed(1),
42
+ after=lambda x: logger.debug(f"get_sell_token_amount failed, {x.attempt_number=}."),
43
+ )
39
44
  def get_sell_token_amount(
40
45
  buy_amount: Wei,
41
46
  sell_token: ChecksumAddress,
@@ -9,7 +9,10 @@ from prediction_market_agent_tooling.tools.contract import (
9
9
  ContractERC20OnGnosisChain,
10
10
  ContractERC4626BaseClass,
11
11
  )
12
- from prediction_market_agent_tooling.tools.cow.cow_order import swap_tokens_waiting
12
+ from prediction_market_agent_tooling.tools.cow.cow_order import (
13
+ get_sell_token_amount,
14
+ swap_tokens_waiting,
15
+ )
13
16
  from prediction_market_agent_tooling.tools.tokens.main_token import KEEPING_ERC20_TOKEN
14
17
  from prediction_market_agent_tooling.tools.tokens.usd import get_usd_in_token
15
18
  from prediction_market_agent_tooling.tools.utils import should_not_happen
@@ -134,8 +137,15 @@ def auto_deposit_erc20(
134
137
  )
135
138
  if not remaining_to_get_in_collateral_wei:
136
139
  return
137
- # Estimate of how much of the source token we need to sell in order to fill the remaining collateral amount, with 1% slippage to be sure.
138
- amount_to_sell_wei = remaining_to_get_in_collateral_wei * 1.01
140
+ # Get of how much of the source token we need to sell in order to fill the remaining collateral amount, with 1% slippage to be sure.
141
+ amount_to_sell_wei = (
142
+ get_sell_token_amount(
143
+ remaining_to_get_in_collateral_wei,
144
+ sell_token=KEEPING_ERC20_TOKEN.address,
145
+ buy_token=collateral_token_contract.address,
146
+ )
147
+ * 1.01
148
+ )
139
149
  # If we don't have enough of the source token.
140
150
  if amount_to_sell_wei > ContractERC20OnGnosisChain(
141
151
  address=KEEPING_ERC20_TOKEN.address
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.62.0.dev468
3
+ Version: 0.62.0.dev470
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -87,7 +87,7 @@ prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp
87
87
  prediction_market_agent_tooling/tools/contract.py,sha256=K9i7J4F7gt6saoKT3tx5S-fPYVh-eCliJpg2T1eNBWo,20998
88
88
  prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
89
89
  prediction_market_agent_tooling/tools/cow/cow_manager.py,sha256=F6T4SlKDQ06nwz3W2wVBr0VqgVvdb4Wphf-kI31W4ms,3792
90
- prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=OIOhOWiEW5R3D43kYKmW0qQeZsEmboI6Rh7nMp4MCl0,5341
90
+ prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=RdbIUlE7ssQAXKDYEWK1twrt57pWCdYCqdlzrAGFI_k,5523
91
91
  prediction_market_agent_tooling/tools/custom_exceptions.py,sha256=Fh8z1fbwONvP4-j7AmV_PuEcoqb6-QXa9PJ9m7guMcM,93
92
92
  prediction_market_agent_tooling/tools/datetime_utc.py,sha256=8_WackjtjC8zHXrhQFTGQ6e6Fz_6llWoKR4CSFvIv9I,2766
93
93
  prediction_market_agent_tooling/tools/db/db_manager.py,sha256=GtzHH1NLl8HwqC8Z7s6eTlIQXuV0blxfaV2PeQrBnfQ,3013
@@ -112,7 +112,7 @@ prediction_market_agent_tooling/tools/singleton.py,sha256=CiIELUiI-OeS7U7eeHEt0r
112
112
  prediction_market_agent_tooling/tools/streamlit_user_login.py,sha256=NXEqfjT9Lc9QtliwSGRASIz1opjQ7Btme43H4qJbzgE,3010
113
113
  prediction_market_agent_tooling/tools/tavily/tavily_models.py,sha256=5ldQs1pZe6uJ5eDAuP4OLpzmcqYShlIV67kttNFvGS0,342
114
114
  prediction_market_agent_tooling/tools/tavily/tavily_search.py,sha256=pPs0qZNfJ7G-1ajfz0iaWOBQyiC0TbcShfrW8T39jtg,3859
115
- prediction_market_agent_tooling/tools/tokens/auto_deposit.py,sha256=M2ozvdLZyX0R3WftrSYT2SNjz-Af-p9huEihgsUUkYA,6567
115
+ prediction_market_agent_tooling/tools/tokens/auto_deposit.py,sha256=ZKGJPoRhch7QVDkZ_5HbBM1si-BKiWyrfuePRh51wqo,6777
116
116
  prediction_market_agent_tooling/tools/tokens/auto_withdraw.py,sha256=nV9jSUt1ydceDj03cTwdyrJs8kFGqz9z6YcvTVUaNg4,2682
117
117
  prediction_market_agent_tooling/tools/tokens/main_token.py,sha256=1rbwpdCusPgQIVFuo3m00nBZ_b2lCAoFVm67i-YDcEw,812
118
118
  prediction_market_agent_tooling/tools/tokens/token_utils.py,sha256=zwV-jGFkPJu4-IslXOUqnsNQjzh_9CrfkruDQL0dq0c,1381
@@ -120,8 +120,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=vUZB7h-nHHfZPUwofCXPR
120
120
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
121
121
  prediction_market_agent_tooling/tools/utils.py,sha256=7P1veh76ni-0EfT7MlRlLE9hHUU498UOx70Lwxe7UaM,6536
122
122
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=eYCc1iWAVtqDKUPTwnMUHuYolPdwh_OTiM3-AdRgDp4,12198
123
- prediction_market_agent_tooling-0.62.0.dev468.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
124
- prediction_market_agent_tooling-0.62.0.dev468.dist-info/METADATA,sha256=gWdZEHRNcX6f_sNL3NREr5aI_yfBjShvnSX01wTh24c,8696
125
- prediction_market_agent_tooling-0.62.0.dev468.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
126
- prediction_market_agent_tooling-0.62.0.dev468.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
127
- prediction_market_agent_tooling-0.62.0.dev468.dist-info/RECORD,,
123
+ prediction_market_agent_tooling-0.62.0.dev470.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
124
+ prediction_market_agent_tooling-0.62.0.dev470.dist-info/METADATA,sha256=8Z0Jkal3_lzmw0lCLl31n4OWWDdD9dLvZFE4f4bBur4,8696
125
+ prediction_market_agent_tooling-0.62.0.dev470.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
126
+ prediction_market_agent_tooling-0.62.0.dev470.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
127
+ prediction_market_agent_tooling-0.62.0.dev470.dist-info/RECORD,,