prediction-market-agent-tooling 0.48.8__tar.gz → 0.48.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.
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/PKG-INFO +1 -1
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/deploy/agent.py +35 -5
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/omen/omen.py +7 -1
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/pyproject.toml +1 -1
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/README.md +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/depositablewrapper_erc20.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/erc20.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/erc4626.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/omen_dxdao.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/omen_fpmm.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/omen_fpmm_conditionaltokens.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/omen_fpmm_factory.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/omen_kleros.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/omen_oracle.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/omen_realitio.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/omen_thumbnailmapping.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/abis/proxy.abi.json +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/benchmark/__init__.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/benchmark/agents.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/benchmark/benchmark.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/benchmark/utils.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/config.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/deploy/agent_example.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/deploy/betting_strategy.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/deploy/constants.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/deploy/gcp/deploy.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/deploy/gcp/kubernetes_models.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/deploy/gcp/utils.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/gtypes.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/loggers.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/agent_market.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/categorize.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/data_models.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/manifold/__init__.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/manifold/api.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/manifold/data_models.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/manifold/manifold.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/manifold/utils.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/markets.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/metaculus/api.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/metaculus/data_models.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/metaculus/metaculus.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/omen/__init__.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/omen/data_models.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/omen/omen_contracts.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/omen/omen_resolving.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/polymarket/api.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/polymarket/data_models.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/polymarket/data_models_web.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/polymarket/polymarket.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/markets/polymarket/utils.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/monitor/markets/manifold.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/monitor/markets/metaculus.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/monitor/markets/omen.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/monitor/markets/polymarket.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/monitor/monitor.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/monitor/monitor_app.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/monitor/monitor_settings.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/py.typed +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/balances.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/betting_strategies/kelly_criterion.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/betting_strategies/market_moving.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/betting_strategies/minimum_bet_to_win.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/betting_strategies/stretch_bet_between.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/cache.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/contract.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/costs.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/gnosis_rpc.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/google.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/hexbytes_custom.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/image_gen/image_gen.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/image_gen/market_thumbnail_gen.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/is_predictable.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/langfuse_.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/parallelism.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/safe.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/singleton.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/streamlit_user_login.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/tavily_storage/tavily_models.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/tavily_storage/tavily_storage.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/utils.py +0 -0
- {prediction_market_agent_tooling-0.48.8 → prediction_market_agent_tooling-0.48.9}/prediction_market_agent_tooling/tools/web3_utils.py +0 -0
@@ -100,6 +100,10 @@ def initialize_langfuse(enable_langfuse: bool) -> None:
|
|
100
100
|
Decision = Annotated[bool, BeforeValidator(to_boolean_outcome)]
|
101
101
|
|
102
102
|
|
103
|
+
class CantPayForGasError(ValueError):
|
104
|
+
pass
|
105
|
+
|
106
|
+
|
103
107
|
class OutOfFundsError(ValueError):
|
104
108
|
pass
|
105
109
|
|
@@ -337,17 +341,38 @@ class DeployableTraderAgent(DeployableAgent):
|
|
337
341
|
]
|
338
342
|
)
|
339
343
|
|
340
|
-
def check_min_required_balance_to_operate(
|
344
|
+
def check_min_required_balance_to_operate(
|
345
|
+
self,
|
346
|
+
market_type: MarketType,
|
347
|
+
check_for_gas: bool = True,
|
348
|
+
check_for_trades: bool = True,
|
349
|
+
) -> None:
|
341
350
|
api_keys = APIKeys()
|
351
|
+
if (
|
352
|
+
market_type == MarketType.OMEN
|
353
|
+
and check_for_gas
|
354
|
+
and not is_minimum_required_balance(
|
355
|
+
api_keys.public_key,
|
356
|
+
min_required_balance=xdai_type(0.001),
|
357
|
+
sum_wxdai=False,
|
358
|
+
)
|
359
|
+
):
|
360
|
+
raise CantPayForGasError(
|
361
|
+
f"{api_keys.public_key=} doesn't have enough xDai to pay for gas."
|
362
|
+
)
|
342
363
|
if self.min_required_balance_to_operate is None:
|
343
364
|
return
|
344
|
-
if
|
345
|
-
|
346
|
-
|
365
|
+
if (
|
366
|
+
market_type == MarketType.OMEN
|
367
|
+
and check_for_trades
|
368
|
+
and not is_minimum_required_balance(
|
369
|
+
api_keys.bet_from_address,
|
370
|
+
min_required_balance=self.min_required_balance_to_operate,
|
371
|
+
)
|
347
372
|
):
|
348
373
|
raise OutOfFundsError(
|
349
374
|
f"Minimum required balance {self.min_required_balance_to_operate} "
|
350
|
-
f"for agent with address {api_keys.
|
375
|
+
f"for agent with address {api_keys.bet_from_address=} is not met."
|
351
376
|
)
|
352
377
|
|
353
378
|
def have_bet_on_market_since(self, market: AgentMarket, since: timedelta) -> bool:
|
@@ -448,8 +473,13 @@ class DeployableTraderAgent(DeployableAgent):
|
|
448
473
|
"""
|
449
474
|
api_keys = APIKeys()
|
450
475
|
if market_type == MarketType.OMEN:
|
476
|
+
# First, check if we have enough xDai to pay for gas, there is no way of doing anything without it.
|
477
|
+
self.check_min_required_balance_to_operate(
|
478
|
+
market_type, check_for_trades=False
|
479
|
+
)
|
451
480
|
# Omen is specific, because the user (agent) needs to manually withdraw winnings from the market.
|
452
481
|
redeem_from_all_user_positions(api_keys)
|
482
|
+
# After redeeming, check if we have enough xDai to pay for gas and place bets.
|
453
483
|
self.check_min_required_balance_to_operate(market_type)
|
454
484
|
# Exchange wxdai back to xdai if the balance is getting low, so we can keep paying for fees.
|
455
485
|
if self.min_balance_to_keep_in_native_currency is not None:
|
@@ -1047,13 +1047,19 @@ def is_minimum_required_balance(
|
|
1047
1047
|
address: ChecksumAddress,
|
1048
1048
|
min_required_balance: xDai,
|
1049
1049
|
web3: Web3 | None = None,
|
1050
|
+
sum_xdai: bool = True,
|
1051
|
+
sum_wxdai: bool = True,
|
1050
1052
|
) -> bool:
|
1051
1053
|
"""
|
1052
1054
|
Checks if the total balance of xDai and wxDai in the wallet is above the minimum required balance.
|
1053
1055
|
"""
|
1054
1056
|
current_balances = get_balances(address, web3)
|
1055
1057
|
# xDai and wxDai have equal value and can be exchanged for almost no cost, so we can sum them up.
|
1056
|
-
total_balance =
|
1058
|
+
total_balance = 0.0
|
1059
|
+
if sum_xdai:
|
1060
|
+
total_balance += current_balances.xdai
|
1061
|
+
if sum_wxdai:
|
1062
|
+
total_balance += current_balances.wxdai
|
1057
1063
|
return total_balance >= min_required_balance
|
1058
1064
|
|
1059
1065
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|