prediction-market-agent-tooling 0.39.1__py3-none-any.whl → 0.39.3__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/agent_market.py +6 -1
- prediction_market_agent_tooling/markets/data_models.py +7 -0
- prediction_market_agent_tooling/markets/omen/omen.py +7 -2
- prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py +3 -1
- {prediction_market_agent_tooling-0.39.1.dist-info → prediction_market_agent_tooling-0.39.3.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.39.1.dist-info → prediction_market_agent_tooling-0.39.3.dist-info}/RECORD +9 -9
- {prediction_market_agent_tooling-0.39.1.dist-info → prediction_market_agent_tooling-0.39.3.dist-info}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.39.1.dist-info → prediction_market_agent_tooling-0.39.3.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.39.1.dist-info → prediction_market_agent_tooling-0.39.3.dist-info}/entry_points.txt +0 -0
@@ -199,11 +199,16 @@ class AgentMarket(BaseModel):
|
|
199
199
|
raise NotImplementedError("Subclasses must implement this method")
|
200
200
|
|
201
201
|
@classmethod
|
202
|
-
def get_positions(
|
202
|
+
def get_positions(
|
203
|
+
cls, user_id: str, liquid_only: bool = False, larger_than: float = 0
|
204
|
+
) -> list[Position]:
|
203
205
|
"""
|
204
206
|
Get all non-zero positions a user has in any market.
|
205
207
|
|
206
208
|
If `liquid_only` is True, only return positions that can be sold.
|
209
|
+
|
210
|
+
If `larger_than` is not None, only return positions with a larger number
|
211
|
+
of tokens than this amount.
|
207
212
|
"""
|
208
213
|
raise NotImplementedError("Subclasses must implement this method")
|
209
214
|
|
@@ -50,6 +50,13 @@ class Position(BaseModel):
|
|
50
50
|
market_id: str
|
51
51
|
amounts: dict[OutcomeStr, TokenAmount]
|
52
52
|
|
53
|
+
@property
|
54
|
+
def total_amount(self) -> TokenAmount:
|
55
|
+
return TokenAmount(
|
56
|
+
amount=sum(amount.amount for amount in self.amounts.values()),
|
57
|
+
currency=self.amounts[next(iter(self.amounts.keys()))].currency,
|
58
|
+
)
|
59
|
+
|
53
60
|
def __str__(self) -> str:
|
54
61
|
amounts_str = ", ".join(
|
55
62
|
f"{amount.amount} '{outcome}' tokens"
|
@@ -367,11 +367,16 @@ class OmenAgentMarket(AgentMarket):
|
|
367
367
|
)
|
368
368
|
|
369
369
|
@classmethod
|
370
|
-
def get_positions(
|
370
|
+
def get_positions(
|
371
|
+
cls,
|
372
|
+
user_id: str,
|
373
|
+
liquid_only: bool = False,
|
374
|
+
larger_than: float = 0,
|
375
|
+
) -> list[Position]:
|
371
376
|
sgh = OmenSubgraphHandler()
|
372
377
|
omen_positions = sgh.get_user_positions(
|
373
378
|
better_address=Web3.to_checksum_address(user_id),
|
374
|
-
total_balance_bigger_than=
|
379
|
+
total_balance_bigger_than=xdai_to_wei(xDai(larger_than)),
|
375
380
|
)
|
376
381
|
|
377
382
|
# Sort positions and corresponding markets by condition_id
|
@@ -383,7 +383,9 @@ class OmenSubgraphHandler(metaclass=SingletonMeta):
|
|
383
383
|
for result_chunk in result:
|
384
384
|
for k, v in result_chunk.items():
|
385
385
|
# subgrounds might pack all items as a list, indexed by a key, or pack it as a dictionary (if one single element)
|
386
|
-
if
|
386
|
+
if v is None:
|
387
|
+
continue
|
388
|
+
elif isinstance(v, dict):
|
387
389
|
items.extend([v])
|
388
390
|
else:
|
389
391
|
items.extend(v)
|
@@ -21,9 +21,9 @@ prediction_market_agent_tooling/deploy/gcp/kubernetes_models.py,sha256=qYIHRxQLa
|
|
21
21
|
prediction_market_agent_tooling/deploy/gcp/utils.py,sha256=oyW0jgrUT2Tr49c7GlpcMsYNQjoCSOcWis3q-MmVAhU,6089
|
22
22
|
prediction_market_agent_tooling/gtypes.py,sha256=lbV2nsPyhMIRI9olx0_6A06jwTWKYBPGMxyiGVFysag,2467
|
23
23
|
prediction_market_agent_tooling/loggers.py,sha256=ua9rynYmsbOJZjxPIFxRBooomeN08zuLSJ7lxZMDS7w,3133
|
24
|
-
prediction_market_agent_tooling/markets/agent_market.py,sha256=
|
24
|
+
prediction_market_agent_tooling/markets/agent_market.py,sha256=ZpBpNLqY2QXTAdmkCr8-L3yjN70H_y-KiCptx3OFQgM,8099
|
25
25
|
prediction_market_agent_tooling/markets/categorize.py,sha256=yTd-lDMPW4ESDSzmxeLLBuzLX0FggOF7Vbswh7295o0,941
|
26
|
-
prediction_market_agent_tooling/markets/data_models.py,sha256=
|
26
|
+
prediction_market_agent_tooling/markets/data_models.py,sha256=6J8tyq-ZJI2HknqJolDCMfWXVXZsdBq3EhVQeIiT6bY,1418
|
27
27
|
prediction_market_agent_tooling/markets/manifold/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
28
|
prediction_market_agent_tooling/markets/manifold/api.py,sha256=m6qOzDiyQfxj62Eo_SzzQLkX4ijpi8KtQKGd4CpKAsk,7307
|
29
29
|
prediction_market_agent_tooling/markets/manifold/data_models.py,sha256=Iw-ajDPYhtfcTfN45nJN_kZShfWcWe9mgzexSWnQCCQ,5295
|
@@ -32,10 +32,10 @@ prediction_market_agent_tooling/markets/manifold/utils.py,sha256=cPPFWXm3vCYH1jy
|
|
32
32
|
prediction_market_agent_tooling/markets/markets.py,sha256=w05Oo7yCA2axpCw69Q9y4i9Gcdpht0u5bZGbWqld3rU,2964
|
33
33
|
prediction_market_agent_tooling/markets/omen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
34
|
prediction_market_agent_tooling/markets/omen/data_models.py,sha256=EXtjmcujx68Xu50BVkYXvLuf_Asx5o65RvFS3ZS6HGs,14405
|
35
|
-
prediction_market_agent_tooling/markets/omen/omen.py,sha256=
|
35
|
+
prediction_market_agent_tooling/markets/omen/omen.py,sha256=dMun3MvkvEVrBmN2NwCCb1Uq3kd9nePe1FhFBgHHcj0,36868
|
36
36
|
prediction_market_agent_tooling/markets/omen/omen_contracts.py,sha256=-EEmN4vA8Fn52ewqQ7ZXZAFnfP4EQ4YISkeDHb9oeLk,21722
|
37
37
|
prediction_market_agent_tooling/markets/omen/omen_resolving.py,sha256=g77QsQ5WnSI2rzBlX87L_EhWMwobkyXyfRhHQmpAdzo,9012
|
38
|
-
prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py,sha256=
|
38
|
+
prediction_market_agent_tooling/markets/omen/omen_subgraph_handler.py,sha256=35cRqXuU4DvP5weYKcFNpJXhbaC1cfNBSfOYeO2HagE,23833
|
39
39
|
prediction_market_agent_tooling/markets/polymarket/api.py,sha256=HXmA1akA0qDj0m3e-GEvWG8x75pm6BX4H7YJPQcST7I,4767
|
40
40
|
prediction_market_agent_tooling/markets/polymarket/data_models.py,sha256=9CJzakyEcsn6DQBK2nOXjOMzTZBLAmK_KqevXvW17DI,4292
|
41
41
|
prediction_market_agent_tooling/markets/polymarket/data_models_web.py,sha256=f8SRQy0Rn-gIHSEMrJJAI8H3J7l8lzOLj3aCMe0vJv8,11324
|
@@ -69,8 +69,8 @@ prediction_market_agent_tooling/tools/singleton.py,sha256=CiIELUiI-OeS7U7eeHEt0r
|
|
69
69
|
prediction_market_agent_tooling/tools/streamlit_user_login.py,sha256=NXEqfjT9Lc9QtliwSGRASIz1opjQ7Btme43H4qJbzgE,3010
|
70
70
|
prediction_market_agent_tooling/tools/utils.py,sha256=-G22UEbCRm59bm1RWFdeF55hRsaxgwZVAHvK32-Ye1g,6190
|
71
71
|
prediction_market_agent_tooling/tools/web3_utils.py,sha256=nKRHmdLnWSKd3wpo-cysXGvhhrJ2Yf69sN2FFQfSt6s,10578
|
72
|
-
prediction_market_agent_tooling-0.39.
|
73
|
-
prediction_market_agent_tooling-0.39.
|
74
|
-
prediction_market_agent_tooling-0.39.
|
75
|
-
prediction_market_agent_tooling-0.39.
|
76
|
-
prediction_market_agent_tooling-0.39.
|
72
|
+
prediction_market_agent_tooling-0.39.3.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
73
|
+
prediction_market_agent_tooling-0.39.3.dist-info/METADATA,sha256=ZdWYKb-oaBVwXys_vDvE64gcqf2fLLzOb95x3kFRqp8,7634
|
74
|
+
prediction_market_agent_tooling-0.39.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
75
|
+
prediction_market_agent_tooling-0.39.3.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
76
|
+
prediction_market_agent_tooling-0.39.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|