prediction-market-agent-tooling 0.25.0__py3-none-any.whl → 0.26.0__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.
@@ -2,10 +2,12 @@ import typing as t
2
2
  from datetime import datetime
3
3
  from enum import Enum
4
4
 
5
+ from eth_typing import ChecksumAddress
5
6
  from pydantic import BaseModel, field_validator
6
7
 
7
8
  from prediction_market_agent_tooling.gtypes import Probability
8
9
  from prediction_market_agent_tooling.markets.data_models import (
10
+ Bet,
9
11
  BetAmount,
10
12
  Currency,
11
13
  Position,
@@ -139,6 +141,12 @@ class AgentMarket(BaseModel):
139
141
  def get_binary_market(id: str) -> "AgentMarket":
140
142
  raise NotImplementedError("Subclasses must implement this method")
141
143
 
144
+ @staticmethod
145
+ def get_bets_made_since(
146
+ better_address: ChecksumAddress, start_time: datetime
147
+ ) -> list[Bet]:
148
+ raise NotImplementedError("Subclasses must implement this method")
149
+
142
150
  def is_resolved(self) -> bool:
143
151
  return self.resolution is not None
144
152
 
@@ -15,6 +15,7 @@ from prediction_market_agent_tooling.gtypes import (
15
15
  xDai,
16
16
  )
17
17
  from prediction_market_agent_tooling.markets.data_models import (
18
+ Bet,
18
19
  BetAmount,
19
20
  Currency,
20
21
  ProfitAmount,
@@ -379,6 +380,14 @@ class OmenBet(BaseModel):
379
380
  currency=Currency.xDai,
380
381
  )
381
382
 
383
+ def to_bet(self) -> Bet:
384
+ return Bet(
385
+ amount=BetAmount(amount=self.collateralAmountUSD, currency=Currency.xDai),
386
+ outcome=self.boolean_outcome,
387
+ created_time=self.creation_datetime,
388
+ market_question=self.title,
389
+ )
390
+
382
391
  def to_generic_resolved_bet(self) -> ResolvedBet:
383
392
  if not self.fpmm.is_resolved_with_valid_answer:
384
393
  raise ValueError(
@@ -24,6 +24,7 @@ from prediction_market_agent_tooling.markets.agent_market import (
24
24
  SortBy,
25
25
  )
26
26
  from prediction_market_agent_tooling.markets.data_models import (
27
+ Bet,
27
28
  BetAmount,
28
29
  Currency,
29
30
  Position,
@@ -265,6 +266,19 @@ class OmenAgentMarket(AgentMarket):
265
266
  )
266
267
  )
267
268
 
269
+ @staticmethod
270
+ def get_bets_made_since(
271
+ better_address: ChecksumAddress, start_time: datetime
272
+ ) -> list[Bet]:
273
+ bets = OmenSubgraphHandler().get_bets(
274
+ better_address=better_address, start_time=start_time
275
+ )
276
+ # get unique titles
277
+ seen_titles = {bet.title: bet for bet in bets}
278
+ bets = list(seen_titles.values())
279
+ bets.sort(key=lambda x: x.creation_datetime)
280
+ return [b.to_bet() for b in bets]
281
+
268
282
  def get_contract(
269
283
  self,
270
284
  ) -> OmenFixedProductMarketMakerContract:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.25.0
3
+ Version: 0.26.0
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.12
@@ -20,7 +20,7 @@ prediction_market_agent_tooling/deploy/gcp/kubernetes_models.py,sha256=qYIHRxQLa
20
20
  prediction_market_agent_tooling/deploy/gcp/utils.py,sha256=oyW0jgrUT2Tr49c7GlpcMsYNQjoCSOcWis3q-MmVAhU,6089
21
21
  prediction_market_agent_tooling/gtypes.py,sha256=xGSJXw12hzp8LwvQ956l01GiZMWd07MZTYqo8CXVeLY,2417
22
22
  prediction_market_agent_tooling/loggers.py,sha256=0znHrzxSbeBaDiB920EZC6a2TiF0tw80Sa_yoLwvo_w,2289
23
- prediction_market_agent_tooling/markets/agent_market.py,sha256=qeuIXEujziDu_gQPvMiHsGSejhkPQtHhO_E7l16NOL0,5997
23
+ prediction_market_agent_tooling/markets/agent_market.py,sha256=b2gsqEXADJir_LxcNUmzEfxGCcJ_V5mWPGM2SZfIA6M,6250
24
24
  prediction_market_agent_tooling/markets/categorize.py,sha256=yTd-lDMPW4ESDSzmxeLLBuzLX0FggOF7Vbswh7295o0,941
25
25
  prediction_market_agent_tooling/markets/data_models.py,sha256=uODY3aoFp8YYeLAUcrzMk1yU8pIKsTLobB9xIEGTmKs,1170
26
26
  prediction_market_agent_tooling/markets/manifold/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -30,8 +30,8 @@ prediction_market_agent_tooling/markets/manifold/manifold.py,sha256=DJZ88r5BGtAu
30
30
  prediction_market_agent_tooling/markets/manifold/utils.py,sha256=cPPFWXm3vCYH1jy7_ctJZuQH9ZDaPL4_AgAYzGWkoow,513
31
31
  prediction_market_agent_tooling/markets/markets.py,sha256=TXo2qNmjUXhbTK0d-V7hW_aaJDpqP9RWHxm7mayhI0o,3042
32
32
  prediction_market_agent_tooling/markets/omen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- prediction_market_agent_tooling/markets/omen/data_models.py,sha256=g6A_DQ54m-_3XQO02AM4NliDycsgYvg8hgpt8Dri5cg,14111
34
- prediction_market_agent_tooling/markets/omen/omen.py,sha256=GZEMVVTT53XLCnDgg3BzvAHMYv-7u4Diy_RgB6J_F8M,31856
33
+ prediction_market_agent_tooling/markets/omen/data_models.py,sha256=f7RO1Zvytii-M2koGuLQiPERjTq_DsDjrT01mar_sX4,14398
34
+ prediction_market_agent_tooling/markets/omen/omen.py,sha256=iNL8m5qzkkxr_ohDfQaYIGiFg92h70WOMxq8-udToIE,32337
35
35
  prediction_market_agent_tooling/markets/omen/omen_contracts.py,sha256=cHL-VYQDzLWLtqS_4l91HGaKAOKoFjXHN76OYfIU2T0,20537
36
36
  prediction_market_agent_tooling/markets/omen/omen_resolving.py,sha256=WbVAQyhFlwFCk1wncs3Uf2PM6YZ9hV7pUbkFIGGu8iw,9067
37
37
  prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py,sha256=QZWwkqvOqQ-b15jidwTNsn1K64x3FY_Un-l6A6g3Twg,22299
@@ -65,8 +65,8 @@ prediction_market_agent_tooling/tools/safe.py,sha256=h0xOO0eNtitClf0fPkn-0oTc6A_
65
65
  prediction_market_agent_tooling/tools/singleton.py,sha256=CiIELUiI-OeS7U7eeHEt0rnVhtQGzwoUdAgn_7u_GBM,729
66
66
  prediction_market_agent_tooling/tools/utils.py,sha256=zkmwPi3YisgZDPCeNwaRbL8sInOYOkvFgFY4Q8PbEo4,5077
67
67
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=cboATXNmEdn5RmPbVblHOwOdUMKBYrUK3GiI6i6Vzxo,9855
68
- prediction_market_agent_tooling-0.25.0.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
69
- prediction_market_agent_tooling-0.25.0.dist-info/METADATA,sha256=tEy4kZbjnTPcDqAV-Xurl46gsZEoFSa4DJh-UZ2kdMs,5465
70
- prediction_market_agent_tooling-0.25.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
71
- prediction_market_agent_tooling-0.25.0.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
72
- prediction_market_agent_tooling-0.25.0.dist-info/RECORD,,
68
+ prediction_market_agent_tooling-0.26.0.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
69
+ prediction_market_agent_tooling-0.26.0.dist-info/METADATA,sha256=WS8GWqlx4050Kncw9dK8RBO2RTWVkWOaeINf-O94paM,5465
70
+ prediction_market_agent_tooling-0.26.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
71
+ prediction_market_agent_tooling-0.26.0.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
72
+ prediction_market_agent_tooling-0.26.0.dist-info/RECORD,,