prediction-market-agent-tooling 0.60.2__py3-none-any.whl → 0.60.4__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.
@@ -757,6 +757,7 @@ def omen_buy_outcome_tx(
757
757
  outcome: str,
758
758
  auto_deposit: bool,
759
759
  web3: Web3 | None = None,
760
+ slippage: float = 0.01,
760
761
  ) -> str:
761
762
  """
762
763
  Bets the given amount of xDai for the given outcome in the given market.
@@ -776,8 +777,8 @@ def omen_buy_outcome_tx(
776
777
  expected_shares = market_contract.calcBuyAmount(
777
778
  amount_wei_to_buy, outcome_index, web3=web3
778
779
  )
779
- # Allow 1% slippage.
780
- expected_shares = remove_fraction(expected_shares, 0.01)
780
+ # Allow small slippage.
781
+ expected_shares = remove_fraction(expected_shares, slippage)
781
782
  # Approve the market maker to withdraw our collateral token.
782
783
  collateral_token_contract.approve(
783
784
  api_keys=api_keys,
@@ -829,6 +830,7 @@ def omen_sell_outcome_tx(
829
830
  outcome: str,
830
831
  auto_withdraw: bool,
831
832
  web3: Web3 | None = None,
833
+ slippage: float = 0.001,
832
834
  ) -> str:
833
835
  """
834
836
  Sells the given xDai value of shares corresponding to the given outcome in
@@ -838,6 +840,7 @@ def omen_sell_outcome_tx(
838
840
  transaction.
839
841
  """
840
842
  amount_wei = xdai_to_wei(amount)
843
+ amount_wei = remove_fraction(amount_wei, slippage)
841
844
 
842
845
  market_contract: OmenFixedProductMarketMakerContract = market.get_contract()
843
846
  conditional_token_contract = OmenConditionalTokenContract()
@@ -859,8 +862,8 @@ def omen_sell_outcome_tx(
859
862
  max_outcome_tokens_to_sell = market_contract.calcSellAmount(
860
863
  amount_wei, outcome_index, web3=web3
861
864
  )
862
- # Allow 1% slippage.
863
- max_outcome_tokens_to_sell = add_fraction(max_outcome_tokens_to_sell, 0.01)
865
+ # Allow small slippage.
866
+ max_outcome_tokens_to_sell = add_fraction(max_outcome_tokens_to_sell, slippage)
864
867
 
865
868
  # Approve the market maker to move our (all) conditional tokens.
866
869
  conditional_token_contract.setApprovalForAll(
@@ -91,6 +91,7 @@ def db_cache(
91
91
  api_keys=api_keys,
92
92
  ignore_args=ignore_args,
93
93
  ignore_arg_types=ignore_arg_types,
94
+ log_error_on_unsavable_data=log_error_on_unsavable_data,
94
95
  )
95
96
 
96
97
  return decorator
@@ -1,4 +1,5 @@
1
1
  import binascii
2
+ import secrets
2
3
  from typing import Any, Optional, TypeVar
3
4
 
4
5
  import base58
@@ -20,6 +21,7 @@ from prediction_market_agent_tooling.gtypes import (
20
21
  HexStr,
21
22
  IPFSCIDVersion0,
22
23
  PrivateKey,
24
+ private_key_type,
23
25
  xDai,
24
26
  xdai_type,
25
27
  )
@@ -31,6 +33,10 @@ ZERO_BYTES = HexBytes(HASH_ZERO)
31
33
  NOT_REVERTED_ICASE_REGEX_PATTERN = "(?i)(?!.*reverted.*)"
32
34
 
33
35
 
36
+ def generate_private_key() -> PrivateKey:
37
+ return private_key_type("0x" + secrets.token_hex(32))
38
+
39
+
34
40
  def private_key_to_public_key(private_key: SecretStr) -> ChecksumAddress:
35
41
  account = Account.from_key(private_key.get_secret_value())
36
42
  return verify_address(account.address)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.60.2
3
+ Version: 0.60.4
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -51,7 +51,7 @@ prediction_market_agent_tooling/markets/metaculus/data_models.py,sha256=FaBCTPPe
51
51
  prediction_market_agent_tooling/markets/metaculus/metaculus.py,sha256=86TIx6cavEWc8Cv4KpZxSvwiSw9oFybXE3YB49pg-CA,4377
52
52
  prediction_market_agent_tooling/markets/omen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  prediction_market_agent_tooling/markets/omen/data_models.py,sha256=sfaOpNk6oFIzxYQzs9EehqAT_19IxYJy9pns-UTepOc,28934
54
- prediction_market_agent_tooling/markets/omen/omen.py,sha256=ZLKa0X5hSQucqcqIyuwUM_NzHuAlbLZzUPSqSQBUscE,53213
54
+ prediction_market_agent_tooling/markets/omen/omen.py,sha256=FUPGOKmhiKjLHLmfgHBM_MzoiKVWiPOu8SzRk-AKrNk,53339
55
55
  prediction_market_agent_tooling/markets/omen/omen_constants.py,sha256=D9oflYKafLQiHYtB5sScMHqmXyzM8JP8J0yATmc4SQQ,233
56
56
  prediction_market_agent_tooling/markets/omen/omen_contracts.py,sha256=EXqBlVivbmW8aBQ65O09X2xkyesHAop49GUl1tUffWA,28648
57
57
  prediction_market_agent_tooling/markets/omen/omen_resolving.py,sha256=B4z9dPqtEfows8-1hkstBLLS_7X0L9z3CG41adyCYgg,10336
@@ -80,7 +80,7 @@ prediction_market_agent_tooling/tools/betting_strategies/market_moving.py,sha256
80
80
  prediction_market_agent_tooling/tools/betting_strategies/minimum_bet_to_win.py,sha256=-FUSuQQgjcWSSnoFxnlAyTeilY6raJABJVM2QKkFqAY,438
81
81
  prediction_market_agent_tooling/tools/betting_strategies/stretch_bet_between.py,sha256=THMXwFlskvzbjnX_OiYtDSzI8XVFyULWfP2525_9UGc,429
82
82
  prediction_market_agent_tooling/tools/betting_strategies/utils.py,sha256=kpIb-ci67Vc1Yqqaa-_S4OUkbhWSIYog4_Iwp69HU_k,97
83
- prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=j8ULI7z0BDaKg16Vua1UbhrIKEjqpa8800haYPQaF9w,11358
83
+ prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=dB8LNs2JvVRaFCeAKRmIQRwiirsMgtL31he8051wM-g,11431
84
84
  prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=ZW5iI5rmjqeAebu5T7ftRnlkxiL02IC-MxCfDB80x7w,1506
85
85
  prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp2q0sv27j4al_M_Tj9aR2JJP-xNHQXA,2151
86
86
  prediction_market_agent_tooling/tools/contract.py,sha256=BCl3R-n5jpp5XPAho9yTuUxRbOoKbZSga1Qaa4RfAp8,20945
@@ -116,9 +116,9 @@ prediction_market_agent_tooling/tools/tokens/auto_withdraw.py,sha256=25Y0H1p0hSD
116
116
  prediction_market_agent_tooling/tools/tokens/main_token.py,sha256=7JPgVF4RbiFzLDQVBkBuC--eUoM1AYOcJ4VygbmK5yo,822
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=2PXZfGRrDVZD60agVpBN4JkOF0YsNBXgTEH1y-V71uQ,12723
120
- prediction_market_agent_tooling-0.60.2.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
121
- prediction_market_agent_tooling-0.60.2.dist-info/METADATA,sha256=vijNsJBwWEVEPwvWJdGA-SQ7uklcgNzXF5IbcQyTVZs,8629
122
- prediction_market_agent_tooling-0.60.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
123
- prediction_market_agent_tooling-0.60.2.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
124
- prediction_market_agent_tooling-0.60.2.dist-info/RECORD,,
119
+ prediction_market_agent_tooling/tools/web3_utils.py,sha256=3wfqNxvMn44ivweFRoeKNVb9QRtFd7kFtp7VUY5juEE,12862
120
+ prediction_market_agent_tooling-0.60.4.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
121
+ prediction_market_agent_tooling-0.60.4.dist-info/METADATA,sha256=XUcZ1GvIf1NZJx1w-Ib0l-piJSX4xzZl78PzsvRpYjI,8629
122
+ prediction_market_agent_tooling-0.60.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
123
+ prediction_market_agent_tooling-0.60.4.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
124
+ prediction_market_agent_tooling-0.60.4.dist-info/RECORD,,