prediction-market-agent-tooling 0.62.0.dev492__py3-none-any.whl → 0.62.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/deploy/agent.py +21 -5
- {prediction_market_agent_tooling-0.62.0.dev492.dist-info → prediction_market_agent_tooling-0.62.1.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.62.0.dev492.dist-info → prediction_market_agent_tooling-0.62.1.dist-info}/RECORD +6 -6
- {prediction_market_agent_tooling-0.62.0.dev492.dist-info → prediction_market_agent_tooling-0.62.1.dist-info}/LICENSE +0 -0
- {prediction_market_agent_tooling-0.62.0.dev492.dist-info → prediction_market_agent_tooling-0.62.1.dist-info}/WHEEL +0 -0
- {prediction_market_agent_tooling-0.62.0.dev492.dist-info → prediction_market_agent_tooling-0.62.1.dist-info}/entry_points.txt +0 -0
@@ -65,7 +65,11 @@ from prediction_market_agent_tooling.tools.langfuse_ import langfuse_context, ob
|
|
65
65
|
from prediction_market_agent_tooling.tools.tokens.main_token import (
|
66
66
|
MINIMUM_NATIVE_TOKEN_IN_EOA_FOR_FEES,
|
67
67
|
)
|
68
|
-
from prediction_market_agent_tooling.tools.utils import
|
68
|
+
from prediction_market_agent_tooling.tools.utils import (
|
69
|
+
DatetimeUTC,
|
70
|
+
check_not_none,
|
71
|
+
utcnow,
|
72
|
+
)
|
69
73
|
|
70
74
|
MAX_AVAILABLE_MARKETS = 1000
|
71
75
|
|
@@ -615,9 +619,9 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
615
619
|
return None
|
616
620
|
|
617
621
|
api_keys = APIKeys()
|
618
|
-
|
619
|
-
|
620
|
-
)
|
622
|
+
user_id = market.get_user_id(api_keys=api_keys)
|
623
|
+
|
624
|
+
existing_position = market.get_position(user_id=user_id)
|
621
625
|
trades = self.build_trades(
|
622
626
|
market=market,
|
623
627
|
answer=processed_market.answer,
|
@@ -643,8 +647,20 @@ class DeployableTraderAgent(DeployablePredictionAgent):
|
|
643
647
|
outcome=trade.outcome, amount=trade.amount
|
644
648
|
)
|
645
649
|
case TradeType.SELL:
|
650
|
+
# Get actual value of the position we are going to sell, and if it's less than we wanted to sell, simply sell all of it.
|
651
|
+
current_position_value = check_not_none(
|
652
|
+
market.get_position(user_id),
|
653
|
+
"Should exists if we are going to sell outcomes.",
|
654
|
+
).amounts_current[
|
655
|
+
market.get_outcome_str_from_bool(trade.outcome)
|
656
|
+
]
|
657
|
+
if current_position_value < trade.amount:
|
658
|
+
logger.warning(
|
659
|
+
f"Current value of position {trade.outcome=}, {current_position_value=} is less than the desired selling amount {trade.amount=}. Selling all."
|
660
|
+
)
|
646
661
|
id = market.sell_tokens(
|
647
|
-
outcome=trade.outcome,
|
662
|
+
outcome=trade.outcome,
|
663
|
+
amount=min(trade.amount, current_position_value),
|
648
664
|
)
|
649
665
|
case _:
|
650
666
|
raise ValueError(f"Unexpected trade type {trade.trade_type}.")
|
@@ -21,7 +21,7 @@ prediction_market_agent_tooling/benchmark/agents.py,sha256=B1-uWdyeN4GGKMWGK_-Cc
|
|
21
21
|
prediction_market_agent_tooling/benchmark/benchmark.py,sha256=MqTiaaJ3cYiOLUVR7OyImLWxcEya3Rl5JyFYW-K0lwM,17097
|
22
22
|
prediction_market_agent_tooling/benchmark/utils.py,sha256=D0MfUkVZllmvcU0VOurk9tcKT7JTtwwOp-63zuCBVuc,2880
|
23
23
|
prediction_market_agent_tooling/config.py,sha256=So5l8KbgmzcCpxzzf13TNrEJPu_4iQnUDhzus6XRvSc,10151
|
24
|
-
prediction_market_agent_tooling/deploy/agent.py,sha256=
|
24
|
+
prediction_market_agent_tooling/deploy/agent.py,sha256=OyrhPOjByQOAi1_VWhef7ieKqREjVhvjGHgnUIQc3gI,25877
|
25
25
|
prediction_market_agent_tooling/deploy/agent_example.py,sha256=dIIdZashExWk9tOdyDjw87AuUcGyM7jYxNChYrVK2dM,1001
|
26
26
|
prediction_market_agent_tooling/deploy/betting_strategy.py,sha256=iU-D7cdcwiCOWbjDt8hin3ZpL633pQbw9GIKRnIR3FY,12494
|
27
27
|
prediction_market_agent_tooling/deploy/constants.py,sha256=M5ty8URipYMGe_G-RzxRydK3AFL6CyvmqCraJUrLBnE,82
|
@@ -120,8 +120,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=l4vPemtF6Zcwh8HNXH3-L
|
|
120
120
|
prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
|
121
121
|
prediction_market_agent_tooling/tools/utils.py,sha256=1xsyBBJfiEdSoMlceB2F8o2sCb6Z8-qNz11pEJFrdyE,6566
|
122
122
|
prediction_market_agent_tooling/tools/web3_utils.py,sha256=eYCc1iWAVtqDKUPTwnMUHuYolPdwh_OTiM3-AdRgDp4,12198
|
123
|
-
prediction_market_agent_tooling-0.62.
|
124
|
-
prediction_market_agent_tooling-0.62.
|
125
|
-
prediction_market_agent_tooling-0.62.
|
126
|
-
prediction_market_agent_tooling-0.62.
|
127
|
-
prediction_market_agent_tooling-0.62.
|
123
|
+
prediction_market_agent_tooling-0.62.1.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
124
|
+
prediction_market_agent_tooling-0.62.1.dist-info/METADATA,sha256=SUwE6KWnE12lLfpELgWnqElM_ajSmNiJLqajBorQrfU,8689
|
125
|
+
prediction_market_agent_tooling-0.62.1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
126
|
+
prediction_market_agent_tooling-0.62.1.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
127
|
+
prediction_market_agent_tooling-0.62.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|