prediction-market-agent-tooling 0.66.6__py3-none-any.whl → 0.67.1__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/markets/metaculus/metaculus.py +2 -2
- prediction_market_agent_tooling/markets/seer/price_manager.py +65 -46
- prediction_market_agent_tooling/markets/seer/seer.py +56 -72
- prediction_market_agent_tooling/markets/seer/swap_pool_handler.py +1 -1
- prediction_market_agent_tooling/tools/cow/cow_order.py +24 -11
- prediction_market_agent_tooling/tools/cow/models.py +4 -2
- {prediction_market_agent_tooling-0.66.6.dist-info → prediction_market_agent_tooling-0.67.1.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.66.6.dist-info → prediction_market_agent_tooling-0.67.1.dist-info}/RECORD +11 -11
- {prediction_market_agent_tooling-0.66.6.dist-info → prediction_market_agent_tooling-0.67.1.dist-info}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.66.6.dist-info → prediction_market_agent_tooling-0.67.1.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.66.6.dist-info → prediction_market_agent_tooling-0.67.1.dist-info}/entry_points.txt +0 -0
@@ -67,15 +67,15 @@ class MetaculusAgentMarket(AgentMarket):
|
|
67
67
|
)
|
68
68
|
|
69
69
|
@staticmethod
|
70
|
-
def get_markets(
|
70
|
+
def get_markets(
|
71
71
|
limit: int,
|
72
72
|
sort_by: SortBy = SortBy.NONE,
|
73
73
|
filter_by: FilterBy = FilterBy.OPEN,
|
74
74
|
created_after: t.Optional[DatetimeUTC] = None,
|
75
75
|
excluded_questions: set[str] | None = None,
|
76
|
-
tournament_id: int | None = None,
|
77
76
|
market_type: MarketType = MarketType.ALL,
|
78
77
|
include_conditional_markets: bool = False,
|
78
|
+
tournament_id: int | None = None,
|
79
79
|
) -> t.Sequence["MetaculusAgentMarket"]:
|
80
80
|
order_by: str | None
|
81
81
|
if sort_by == SortBy.NONE:
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import typing as t
|
2
|
-
|
3
1
|
from cachetools import TTLCache, cached
|
2
|
+
from pydantic import BaseModel
|
4
3
|
from web3 import Web3
|
5
4
|
|
6
5
|
from prediction_market_agent_tooling.gtypes import (
|
@@ -18,32 +17,15 @@ from prediction_market_agent_tooling.markets.seer.exceptions import (
|
|
18
17
|
from prediction_market_agent_tooling.markets.seer.seer_subgraph_handler import (
|
19
18
|
SeerSubgraphHandler,
|
20
19
|
)
|
21
|
-
from prediction_market_agent_tooling.markets.seer.subgraph_data_models import SeerPool
|
22
20
|
from prediction_market_agent_tooling.tools.cow.cow_order import (
|
23
21
|
get_buy_token_amount_else_raise,
|
24
22
|
)
|
25
23
|
from prediction_market_agent_tooling.tools.hexbytes_custom import HexBytes
|
26
24
|
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
collateral_exchange_amount: CollateralToken | None = None,
|
32
|
-
) -> str:
|
33
|
-
"""
|
34
|
-
Generate a unique cache key based on a token address and optional collateral token.
|
35
|
-
"""
|
36
|
-
|
37
|
-
if collateral_exchange_amount is None:
|
38
|
-
return f"{token}-no_collateral"
|
39
|
-
|
40
|
-
return "-".join(
|
41
|
-
[
|
42
|
-
token,
|
43
|
-
collateral_exchange_amount.symbol,
|
44
|
-
str(collateral_exchange_amount.value),
|
45
|
-
]
|
46
|
-
)
|
26
|
+
class Prices(BaseModel):
|
27
|
+
priceOfCollateralInAskingToken: CollateralToken
|
28
|
+
priceOfAskingTokenInCollateral: CollateralToken
|
47
29
|
|
48
30
|
|
49
31
|
class PriceManager:
|
@@ -67,17 +49,17 @@ class PriceManager:
|
|
67
49
|
f"{price_diff_pct=} larger than {max_price_diff=} for seer market {self.seer_market.id.hex()} "
|
68
50
|
)
|
69
51
|
|
70
|
-
|
71
|
-
|
52
|
+
def get_price_for_token(self, token: ChecksumAddress) -> CollateralToken | None:
|
53
|
+
return self.get_amount_of_token_in_collateral(token, CollateralToken(1))
|
54
|
+
|
55
|
+
@cached(TTLCache(maxsize=100, ttl=5 * 60))
|
56
|
+
def get_amount_of_collateral_in_token(
|
72
57
|
self,
|
73
58
|
token: ChecksumAddress,
|
74
|
-
collateral_exchange_amount: CollateralToken
|
59
|
+
collateral_exchange_amount: CollateralToken,
|
75
60
|
) -> CollateralToken | None:
|
76
|
-
|
77
|
-
collateral_exchange_amount
|
78
|
-
if collateral_exchange_amount is not None
|
79
|
-
else CollateralToken(1)
|
80
|
-
)
|
61
|
+
if token == self.seer_market.collateral_token_contract_address_checksummed:
|
62
|
+
return collateral_exchange_amount
|
81
63
|
|
82
64
|
try:
|
83
65
|
buy_token_amount = get_buy_token_amount_else_raise(
|
@@ -85,23 +67,51 @@ class PriceManager:
|
|
85
67
|
sell_token=self.seer_market.collateral_token_contract_address_checksummed,
|
86
68
|
buy_token=token,
|
87
69
|
)
|
88
|
-
|
89
|
-
return CollateralToken(price)
|
70
|
+
return buy_token_amount.as_token
|
90
71
|
|
91
72
|
except Exception as e:
|
92
73
|
logger.warning(
|
93
74
|
f"Could not get quote for {token=} from Cow, exception {e=}. Falling back to pools. "
|
94
75
|
)
|
95
|
-
|
76
|
+
prices = self.get_token_price_from_pools(token=token)
|
77
|
+
return (
|
78
|
+
prices.priceOfCollateralInAskingToken * collateral_exchange_amount
|
79
|
+
if prices
|
80
|
+
else None
|
81
|
+
)
|
96
82
|
|
97
|
-
@
|
98
|
-
def
|
99
|
-
|
83
|
+
@cached(TTLCache(maxsize=100, ttl=5 * 60))
|
84
|
+
def get_amount_of_token_in_collateral(
|
85
|
+
self,
|
86
|
+
token: ChecksumAddress,
|
87
|
+
token_exchange_amount: CollateralToken,
|
88
|
+
) -> CollateralToken | None:
|
89
|
+
if token == self.seer_market.collateral_token_contract_address_checksummed:
|
90
|
+
return token_exchange_amount
|
91
|
+
|
92
|
+
try:
|
93
|
+
buy_collateral_amount = get_buy_token_amount_else_raise(
|
94
|
+
sell_amount=token_exchange_amount.as_wei,
|
95
|
+
sell_token=token,
|
96
|
+
buy_token=self.seer_market.collateral_token_contract_address_checksummed,
|
97
|
+
)
|
98
|
+
return buy_collateral_amount.as_token
|
99
|
+
|
100
|
+
except Exception as e:
|
101
|
+
logger.warning(
|
102
|
+
f"Could not get quote for {token=} from Cow, exception {e=}. Falling back to pools. "
|
103
|
+
)
|
104
|
+
prices = self.get_token_price_from_pools(token=token)
|
105
|
+
return (
|
106
|
+
prices.priceOfAskingTokenInCollateral * token_exchange_amount
|
107
|
+
if prices
|
108
|
+
else None
|
109
|
+
)
|
100
110
|
|
101
111
|
def get_token_price_from_pools(
|
102
112
|
self,
|
103
113
|
token: ChecksumAddress,
|
104
|
-
) ->
|
114
|
+
) -> Prices | None:
|
105
115
|
pool = SeerSubgraphHandler().get_pool_by_token(
|
106
116
|
token_address=token,
|
107
117
|
collateral_address=self.seer_market.collateral_token_contract_address_checksummed,
|
@@ -111,15 +121,24 @@ class PriceManager:
|
|
111
121
|
logger.warning(f"Could not find a pool for {token=}")
|
112
122
|
return None
|
113
123
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
124
|
+
if (
|
125
|
+
Web3.to_checksum_address(pool.token0.id)
|
126
|
+
== self.seer_market.collateral_token_contract_address_checksummed
|
127
|
+
):
|
128
|
+
price_coll_in_asking = (
|
129
|
+
pool.token1Price
|
130
|
+
) # how many outcome tokens per 1 collateral
|
131
|
+
price_asking_in_coll = (
|
132
|
+
pool.token0Price
|
133
|
+
) # how many collateral tokens per 1 outcome
|
134
|
+
else:
|
135
|
+
price_coll_in_asking = pool.token0Price
|
136
|
+
price_asking_in_coll = pool.token1Price
|
137
|
+
|
138
|
+
return Prices(
|
139
|
+
priceOfCollateralInAskingToken=price_coll_in_asking,
|
140
|
+
priceOfAskingTokenInCollateral=price_asking_in_coll,
|
121
141
|
)
|
122
|
-
return price
|
123
142
|
|
124
143
|
def build_probability_map(self) -> dict[OutcomeStr, Probability]:
|
125
144
|
# Inspired by https://github.com/seer-pm/demo/blob/ca682153a6b4d4dd3dcc4ad8bdcbe32202fc8fe7/web/src/hooks/useMarketOdds.ts#L15
|
@@ -160,6 +179,6 @@ class PriceManager:
|
|
160
179
|
outcome = self.seer_market.outcomes[
|
161
180
|
self.seer_market.wrapped_tokens.index(outcome_token)
|
162
181
|
]
|
163
|
-
normalized_prices[
|
182
|
+
normalized_prices[outcome] = new_price
|
164
183
|
|
165
184
|
return normalized_prices
|
@@ -68,8 +68,9 @@ from prediction_market_agent_tooling.tools.contract import (
|
|
68
68
|
)
|
69
69
|
from prediction_market_agent_tooling.tools.cow.cow_order import (
|
70
70
|
NoLiquidityAvailableOnCowException,
|
71
|
-
|
71
|
+
OrderStatusError,
|
72
72
|
get_orders_by_owner,
|
73
|
+
get_trades_by_order_uid,
|
73
74
|
get_trades_by_owner,
|
74
75
|
swap_tokens_waiting,
|
75
76
|
wait_for_order_completion,
|
@@ -137,45 +138,34 @@ class SeerAgentMarket(AgentMarket):
|
|
137
138
|
web3=web3,
|
138
139
|
)
|
139
140
|
|
141
|
+
def get_price_manager(self) -> PriceManager:
|
142
|
+
return PriceManager.build(HexBytes(HexStr(self.id)))
|
143
|
+
|
140
144
|
def get_token_in_usd(self, x: CollateralToken) -> USD:
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
145
|
+
p = self.get_price_manager()
|
146
|
+
sdai_amount = p.get_amount_of_collateral_in_token(
|
147
|
+
# Hard-coded SDAI, because Seer is atm hard-coded it as well, and it's needed in case of fallback to pools. CoW would work with other tokens as well.
|
148
|
+
SDAI_CONTRACT_ADDRESS,
|
149
|
+
x,
|
150
|
+
)
|
151
|
+
if sdai_amount is None:
|
152
|
+
raise RuntimeError(
|
153
|
+
"Both CoW and pool-fallback way of getting price failed."
|
148
154
|
)
|
149
|
-
|
150
|
-
if usd_token_price is None:
|
151
|
-
raise RuntimeError(
|
152
|
-
"Both CoW and pool-fallback way of getting price failed."
|
153
|
-
) from e
|
154
|
-
return USD(x.value * usd_token_price.value)
|
155
|
-
|
156
|
-
def get_collateral_price_from_pools(self) -> USD | None:
|
157
|
-
p = PriceManager.build(HexBytes(HexStr(self.id)))
|
158
|
-
token_price = p.get_token_price_from_pools(token=SDAI_CONTRACT_ADDRESS)
|
159
|
-
if token_price:
|
160
|
-
return get_token_in_usd(token_price, SDAI_CONTRACT_ADDRESS)
|
161
|
-
|
162
|
-
return None
|
155
|
+
return get_token_in_usd(sdai_amount, SDAI_CONTRACT_ADDRESS)
|
163
156
|
|
164
157
|
def get_usd_in_token(self, x: USD) -> CollateralToken:
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
158
|
+
p = self.get_price_manager()
|
159
|
+
token_amount = p.get_amount_of_token_in_collateral(
|
160
|
+
# Hard-coded SDAI, because Seer is atm hard-coded it as well, and it's needed in case of fallback to pools. CoW would work with other tokens as well.
|
161
|
+
SDAI_CONTRACT_ADDRESS,
|
162
|
+
get_usd_in_token(x, SDAI_CONTRACT_ADDRESS),
|
163
|
+
)
|
164
|
+
if token_amount is None:
|
165
|
+
raise RuntimeError(
|
166
|
+
"Both CoW and pool-fallback way of getting price failed."
|
172
167
|
)
|
173
|
-
|
174
|
-
if not usd_token_price:
|
175
|
-
raise RuntimeError(
|
176
|
-
"Both CoW and pool-fallback way of getting price failed."
|
177
|
-
) from e
|
178
|
-
return CollateralToken(x.value / usd_token_price.value)
|
168
|
+
return token_amount
|
179
169
|
|
180
170
|
def get_buy_token_amount(
|
181
171
|
self, bet_amount: USD | CollateralToken, outcome_str: OutcomeStr
|
@@ -191,16 +181,15 @@ class SeerAgentMarket(AgentMarket):
|
|
191
181
|
|
192
182
|
bet_amount_in_tokens = self.get_in_token(bet_amount)
|
193
183
|
|
194
|
-
p =
|
195
|
-
|
184
|
+
p = self.get_price_manager()
|
185
|
+
amount_outcome_tokens = p.get_amount_of_collateral_in_token(
|
196
186
|
token=outcome_token, collateral_exchange_amount=bet_amount_in_tokens
|
197
187
|
)
|
198
|
-
if not
|
188
|
+
if not amount_outcome_tokens:
|
199
189
|
logger.info(f"Could not get price for token {outcome_token}")
|
200
190
|
return None
|
201
191
|
|
202
|
-
amount_outcome_tokens
|
203
|
-
return OutcomeToken(amount_outcome_tokens)
|
192
|
+
return OutcomeToken(amount_outcome_tokens.value)
|
204
193
|
|
205
194
|
def get_sell_value_of_outcome_token(
|
206
195
|
self, outcome: OutcomeStr, amount: OutcomeToken
|
@@ -209,26 +198,18 @@ class SeerAgentMarket(AgentMarket):
|
|
209
198
|
return CollateralToken.zero()
|
210
199
|
|
211
200
|
wrapped_outcome_token = self.get_wrapped_token_for_outcome(outcome)
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
logger.warning(
|
222
|
-
f"No liquidity available on Cow for {wrapped_outcome_token} -> {self.collateral_token_contract_address_checksummed}."
|
201
|
+
|
202
|
+
p = self.get_price_manager()
|
203
|
+
value_outcome_token_in_collateral = p.get_amount_of_token_in_collateral(
|
204
|
+
wrapped_outcome_token, amount.as_token
|
205
|
+
)
|
206
|
+
|
207
|
+
if value_outcome_token_in_collateral is None:
|
208
|
+
raise RuntimeError(
|
209
|
+
f"Could not get price for token from pools for {wrapped_outcome_token}"
|
223
210
|
)
|
224
|
-
|
225
|
-
|
226
|
-
if not price:
|
227
|
-
logger.info(
|
228
|
-
f"Could not get price for token from pools for {wrapped_outcome_token}"
|
229
|
-
)
|
230
|
-
raise e
|
231
|
-
return CollateralToken(price.value * amount.value)
|
211
|
+
|
212
|
+
return value_outcome_token_in_collateral
|
232
213
|
|
233
214
|
@staticmethod
|
234
215
|
def get_trade_balance(api_keys: APIKeys) -> USD:
|
@@ -456,7 +437,8 @@ class SeerAgentMarket(AgentMarket):
|
|
456
437
|
f"Could not fetch pool for token {outcome_token}, no liquidity available for outcome."
|
457
438
|
)
|
458
439
|
return CollateralToken(0)
|
459
|
-
|
440
|
+
|
441
|
+
p = self.get_price_manager()
|
460
442
|
total = CollateralToken(0)
|
461
443
|
|
462
444
|
for token_address in [pool.token0.id, pool.token1.id]:
|
@@ -469,19 +451,13 @@ class SeerAgentMarket(AgentMarket):
|
|
469
451
|
for_address=Web3.to_checksum_address(HexAddress(HexStr(pool.id.hex()))),
|
470
452
|
web3=web3,
|
471
453
|
)
|
472
|
-
|
473
|
-
|
474
|
-
token_price_in_sdai = (
|
475
|
-
p.get_token_price_from_pools(token=token_address_checksummed)
|
476
|
-
if token_address_checksummed
|
477
|
-
!= self.collateral_token_contract_address_checksummed
|
478
|
-
else CollateralToken(1.0)
|
454
|
+
collateral_balance = p.get_amount_of_token_in_collateral(
|
455
|
+
token_address_checksummed, token_balance
|
479
456
|
)
|
480
457
|
|
481
458
|
# We ignore the liquidity in outcome tokens if price unknown.
|
482
|
-
if
|
483
|
-
|
484
|
-
total += sdai_balance
|
459
|
+
if collateral_balance:
|
460
|
+
total += collateral_balance
|
485
461
|
|
486
462
|
return total
|
487
463
|
|
@@ -542,15 +518,23 @@ class SeerAgentMarket(AgentMarket):
|
|
542
518
|
slippage_tolerance=slippage_tolerance,
|
543
519
|
)
|
544
520
|
order_metadata = asyncio.run(wait_for_order_completion(order=order))
|
545
|
-
logger.
|
521
|
+
logger.info(
|
546
522
|
f"Swapped {sell_token} for {buy_token}. Order details {order_metadata}"
|
547
523
|
)
|
548
|
-
|
524
|
+
trades = get_trades_by_order_uid(HexBytes(order_metadata.uid.root))
|
525
|
+
if len(trades) != 1:
|
526
|
+
raise ValueError(
|
527
|
+
f"Expected exactly 1 trade from {order_metadata=}, but got {len(trades)=}."
|
528
|
+
)
|
529
|
+
cow_tx_hash = trades[0].txHash
|
530
|
+
logger.info(f"TxHash for {order_metadata.uid.root=} is {cow_tx_hash=}.")
|
531
|
+
return cow_tx_hash.hex()
|
549
532
|
|
550
533
|
except (
|
551
534
|
UnexpectedResponseError,
|
552
535
|
TimeoutError,
|
553
536
|
NoLiquidityAvailableOnCowException,
|
537
|
+
OrderStatusError,
|
554
538
|
) as e:
|
555
539
|
# We don't retry if not enough balance.
|
556
540
|
if "InsufficientBalance" in str(e):
|
@@ -80,7 +80,7 @@ class SwapPoolHandler:
|
|
80
80
|
amount_out_minimum = self._calculate_amount_out_minimum(
|
81
81
|
amount_wei=amount_wei,
|
82
82
|
token_in=token_in,
|
83
|
-
price_outcome_token=price_outcome_token,
|
83
|
+
price_outcome_token=price_outcome_token.priceOfCollateralInAskingToken,
|
84
84
|
)
|
85
85
|
|
86
86
|
p = ExactInputSingleParams(
|
@@ -33,12 +33,7 @@ from cowdao_cowpy.order_book.generated.model import (
|
|
33
33
|
from eth_account import Account
|
34
34
|
from eth_account.signers.local import LocalAccount
|
35
35
|
from eth_keys.datatypes import PrivateKey as eth_keys_PrivateKey
|
36
|
-
from tenacity import
|
37
|
-
retry_if_not_exception_type,
|
38
|
-
stop_after_attempt,
|
39
|
-
wait_exponential,
|
40
|
-
wait_fixed,
|
41
|
-
)
|
36
|
+
from tenacity import stop_after_attempt, wait_exponential, wait_fixed
|
42
37
|
from web3 import Web3
|
43
38
|
|
44
39
|
from prediction_market_agent_tooling.config import APIKeys
|
@@ -54,7 +49,7 @@ from prediction_market_agent_tooling.markets.omen.cow_contracts import (
|
|
54
49
|
CowGPv2SettlementContract,
|
55
50
|
)
|
56
51
|
from prediction_market_agent_tooling.tools.contract import ContractERC20OnGnosisChain
|
57
|
-
from prediction_market_agent_tooling.tools.cow.models import
|
52
|
+
from prediction_market_agent_tooling.tools.cow.models import MinimalisticTrade, Order
|
58
53
|
from prediction_market_agent_tooling.tools.cow.semaphore import postgres_rate_limited
|
59
54
|
from prediction_market_agent_tooling.tools.utils import utcnow
|
60
55
|
|
@@ -108,7 +103,6 @@ def get_sell_token_amount(
|
|
108
103
|
@tenacity.retry(
|
109
104
|
stop=stop_after_attempt(4),
|
110
105
|
wait=wait_exponential(min=4, max=10),
|
111
|
-
retry=retry_if_not_exception_type(NoLiquidityAvailableOnCowException),
|
112
106
|
)
|
113
107
|
def get_quote(
|
114
108
|
amount_wei: Wei,
|
@@ -198,7 +192,7 @@ def handle_allowance(
|
|
198
192
|
reraise=True,
|
199
193
|
stop=stop_after_attempt(3),
|
200
194
|
wait=wait_fixed(1),
|
201
|
-
retry=tenacity.retry_if_not_exception_type((TimeoutError
|
195
|
+
retry=tenacity.retry_if_not_exception_type((TimeoutError)),
|
202
196
|
after=lambda x: logger.debug(f"swap_tokens_waiting failed, {x.attempt_number=}."),
|
203
197
|
)
|
204
198
|
def swap_tokens_waiting(
|
@@ -355,14 +349,33 @@ async def sign_safe_cow_swap(
|
|
355
349
|
)
|
356
350
|
def get_trades_by_owner(
|
357
351
|
owner: ChecksumAddress,
|
358
|
-
) -> list[
|
352
|
+
) -> list[MinimalisticTrade]:
|
359
353
|
# Using this until cowpy gets fixed (https://github.com/cowdao-grants/cow-py/issues/35)
|
360
354
|
response = httpx.get(
|
361
355
|
f"https://api.cow.fi/xdai/api/v1/trades",
|
362
356
|
params={"owner": owner},
|
363
357
|
)
|
364
358
|
response.raise_for_status()
|
365
|
-
return [
|
359
|
+
return [MinimalisticTrade.model_validate(i) for i in response.json()]
|
360
|
+
|
361
|
+
|
362
|
+
@tenacity.retry(
|
363
|
+
stop=stop_after_attempt(3),
|
364
|
+
wait=wait_fixed(1),
|
365
|
+
after=lambda x: logger.debug(
|
366
|
+
f"get_trades_by_order_uid failed, {x.attempt_number=}."
|
367
|
+
),
|
368
|
+
)
|
369
|
+
def get_trades_by_order_uid(
|
370
|
+
order_uid: HexBytes,
|
371
|
+
) -> list[MinimalisticTrade]:
|
372
|
+
# Using this until cowpy gets fixed (https://github.com/cowdao-grants/cow-py/issues/35)
|
373
|
+
response = httpx.get(
|
374
|
+
f"https://api.cow.fi/xdai/api/v1/trades",
|
375
|
+
params={"orderUid": order_uid.hex()},
|
376
|
+
)
|
377
|
+
response.raise_for_status()
|
378
|
+
return [MinimalisticTrade.model_validate(i) for i in response.json()]
|
366
379
|
|
367
380
|
|
368
381
|
@tenacity.retry(
|
@@ -1,14 +1,16 @@
|
|
1
1
|
from pydantic import BaseModel
|
2
2
|
from sqlmodel import Field, SQLModel
|
3
3
|
|
4
|
-
from prediction_market_agent_tooling.gtypes import ChecksumAddress
|
4
|
+
from prediction_market_agent_tooling.gtypes import ChecksumAddress, HexBytes
|
5
5
|
from prediction_market_agent_tooling.tools.datetime_utc import DatetimeUTC
|
6
6
|
from prediction_market_agent_tooling.tools.utils import utcnow
|
7
7
|
|
8
8
|
|
9
|
-
class
|
9
|
+
class MinimalisticTrade(BaseModel):
|
10
10
|
sellToken: ChecksumAddress
|
11
11
|
buyToken: ChecksumAddress
|
12
|
+
orderUid: HexBytes
|
13
|
+
txHash: HexBytes
|
12
14
|
|
13
15
|
|
14
16
|
class Order(BaseModel):
|
@@ -54,7 +54,7 @@ prediction_market_agent_tooling/markets/market_fees.py,sha256=YeK3ynjYIguB0xf6sO
|
|
54
54
|
prediction_market_agent_tooling/markets/markets.py,sha256=WAM2Ic8TS5hS1MOgH7zjznBdmCSfO9GaSpypM3a82HE,2922
|
55
55
|
prediction_market_agent_tooling/markets/metaculus/api.py,sha256=4TRPGytQQbSdf42DCg2M_JWYPAuNjqZ3eBqaQBLkNks,2736
|
56
56
|
prediction_market_agent_tooling/markets/metaculus/data_models.py,sha256=WjPt0MKeJNtoY-8oLQTLC8vQYYQ-dBj8UZoPq-UBYsQ,3288
|
57
|
-
prediction_market_agent_tooling/markets/metaculus/metaculus.py,sha256=
|
57
|
+
prediction_market_agent_tooling/markets/metaculus/metaculus.py,sha256=ipwjj-2lYlTVeu6U9GishGk7ZIqmzwXOIqa1cAoWazU,5227
|
58
58
|
prediction_market_agent_tooling/markets/omen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
59
59
|
prediction_market_agent_tooling/markets/omen/cow_contracts.py,sha256=sFaW82u_haL4nze8fjTmnQsOuV0OecunQlAhh1OAw0w,1091
|
60
60
|
prediction_market_agent_tooling/markets/omen/data_models.py,sha256=RsBYSbM4deA6Os4kQ3egH3HvwT80tQho6T1yyoATCMs,31103
|
@@ -71,12 +71,12 @@ prediction_market_agent_tooling/markets/polymarket/polymarket_subgraph_handler.p
|
|
71
71
|
prediction_market_agent_tooling/markets/polymarket/utils.py,sha256=A_diygWKYyp4WHbxAlAVAuC0S0ZqbEKE80wxL6mxHKQ,1275
|
72
72
|
prediction_market_agent_tooling/markets/seer/data_models.py,sha256=Fkn9jG8f0W8XlfM4EFfMSw0V0c3IGSqnKPt1UnG34Ag,6084
|
73
73
|
prediction_market_agent_tooling/markets/seer/exceptions.py,sha256=cEObdjluivD94tgOLzmimR7wgQEOt6SRakrYdhsRQtk,112
|
74
|
-
prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=
|
75
|
-
prediction_market_agent_tooling/markets/seer/seer.py,sha256=
|
74
|
+
prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=PZf6-6zc6DvH1u65wHWyeD55lgG-UGnN_xzBMvrb3ug,7120
|
75
|
+
prediction_market_agent_tooling/markets/seer/seer.py,sha256=V3yBrnAO9sTpRRHVBp5HorW-XgkQMyKY-A4lP1GkT1s,26323
|
76
76
|
prediction_market_agent_tooling/markets/seer/seer_contracts.py,sha256=uMzpHpI6_tgfhWxPzupLdUJlZ1P2wr0rRiYjAGClKgU,4984
|
77
77
|
prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=kNmWzCsKsMn_NUP3eiELl2Ldwx-bg2HojOgKtDXMZ0U,11704
|
78
78
|
prediction_market_agent_tooling/markets/seer/subgraph_data_models.py,sha256=0izxS8Mtzonfdl9UqvFVXrdj0hVzieroekXhogfZKCw,1817
|
79
|
-
prediction_market_agent_tooling/markets/seer/swap_pool_handler.py,sha256=
|
79
|
+
prediction_market_agent_tooling/markets/seer/swap_pool_handler.py,sha256=kS_fJg4XvlMDKhDtVIjQViCtX2luCnTKL1Sd-3gd9pE,3935
|
80
80
|
prediction_market_agent_tooling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
81
|
prediction_market_agent_tooling/tools/_generic_value.py,sha256=pD_PI13lpPp1gFoljHwa_Lzlp-u2pu0m-Z7LcxwDM2U,10618
|
82
82
|
prediction_market_agent_tooling/tools/balances.py,sha256=Osab21btfJDw2Y-jT_TV-KHGrseCRxcsYeW6WcOMB8E,1050
|
@@ -88,8 +88,8 @@ prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=ZW5iI5rmjq
|
|
88
88
|
prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp2q0sv27j4al_M_Tj9aR2JJP-xNHQXA,2151
|
89
89
|
prediction_market_agent_tooling/tools/contract.py,sha256=pdr9ZYmj4QVUfgVKdvOU6ucYdBpJGdha_FMR_LgtcEs,22912
|
90
90
|
prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
|
91
|
-
prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=
|
92
|
-
prediction_market_agent_tooling/tools/cow/models.py,sha256=
|
91
|
+
prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=CtCPnBcHSrWmcCuNxqqPHQwyBTL6pLqtSvNJt49nHno,13810
|
92
|
+
prediction_market_agent_tooling/tools/cow/models.py,sha256=Z_XUAMj5AGHZE-A92oRG0DuPeXTSyWnZRIwKQ49LaXU,709
|
93
93
|
prediction_market_agent_tooling/tools/cow/semaphore.py,sha256=IJGKRgvXnRSkEt_z1i5-eFIoVMcyhr7HK0JfIz1MXdQ,3738
|
94
94
|
prediction_market_agent_tooling/tools/custom_exceptions.py,sha256=Fh8z1fbwONvP4-j7AmV_PuEcoqb6-QXa9PJ9m7guMcM,93
|
95
95
|
prediction_market_agent_tooling/tools/datetime_utc.py,sha256=8_WackjtjC8zHXrhQFTGQ6e6Fz_6llWoKR4CSFvIv9I,2766
|
@@ -127,8 +127,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=yuW8iPPtcpP4eLH2nORMD
|
|
127
127
|
prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
|
128
128
|
prediction_market_agent_tooling/tools/utils.py,sha256=mbOGoWKalNIm7M2K51TEPGwU9oVp1Z6SPsFaBgbn6ws,7397
|
129
129
|
prediction_market_agent_tooling/tools/web3_utils.py,sha256=0r26snqCXGdLKCWA8jpe7DV8x2NPYWZwOy4oyKyDCYk,12615
|
130
|
-
prediction_market_agent_tooling-0.
|
131
|
-
prediction_market_agent_tooling-0.
|
132
|
-
prediction_market_agent_tooling-0.
|
133
|
-
prediction_market_agent_tooling-0.
|
134
|
-
prediction_market_agent_tooling-0.
|
130
|
+
prediction_market_agent_tooling-0.67.1.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
131
|
+
prediction_market_agent_tooling-0.67.1.dist-info/METADATA,sha256=P0pmEOh1l9XQz-FdVuWakPmPcM8PKvyx7Ae-kALL-7U,8726
|
132
|
+
prediction_market_agent_tooling-0.67.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
133
|
+
prediction_market_agent_tooling-0.67.1.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
134
|
+
prediction_market_agent_tooling-0.67.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|