prediction-market-agent-tooling 0.33.0__py3-none-any.whl → 0.34.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.
@@ -79,7 +79,7 @@ class ManifoldMarket(BaseModel):
79
79
  """
80
80
  Clip the timestamp to the maximum valid timestamp.
81
81
  """
82
- max_timestamp = (datetime.max - timedelta(hours=1)).timestamp()
82
+ max_timestamp = (datetime.max - timedelta(days=1)).timestamp()
83
83
  value = int(min(value / 1000, max_timestamp))
84
84
  return datetime.fromtimestamp(value)
85
85
 
@@ -185,7 +185,7 @@ def monitor_agent(agent: DeployedAgent) -> None:
185
185
  col3.markdown(f"Public ID: `{agent.public_id}`")
186
186
 
187
187
  show_agent_bets = st.checkbox(
188
- "Show resolved bets", value=False, key=f"{agent.name}_show_bets"
188
+ "Show resolved bets statistics", value=False, key=f"{agent.name}_show_bets"
189
189
  )
190
190
  if not show_agent_bets:
191
191
  return
@@ -203,16 +203,43 @@ def monitor_agent(agent: DeployedAgent) -> None:
203
203
  "Is Correct": [bet.is_correct for bet in agent_bets],
204
204
  "Profit": [round(bet.profit.amount, 2) for bet in agent_bets],
205
205
  }
206
- bets_df = pd.DataFrame(bets_info).sort_values(by="Resolved Time")
206
+
207
+ # Time column to use for x-axes and sorting
208
+ x_axis_column = st.selectbox(
209
+ "X-axis column",
210
+ ["Created Time", "Resolved Time"],
211
+ key=f"{agent.name}_x_axis_column",
212
+ )
213
+
214
+ bets_df = pd.DataFrame(bets_info).sort_values(by=x_axis_column, ascending=False)
215
+ bets_df["x-axis-day"] = bets_df[x_axis_column].dt.date
207
216
 
208
217
  # Metrics
209
218
  col1, col2 = st.columns(2)
210
219
  col1.metric(label="Number of bets", value=f"{len(agent_bets)}")
211
220
  col2.metric(label="% Correct", value=f"{100 * bets_df['Is Correct'].mean():.2f}%")
212
221
 
222
+ # Chart of grouped accuracy per day
223
+ per_day_accuracy = bets_df.groupby("x-axis-day")["Is Correct"].mean()
224
+ per_day_accuracy_chart = (
225
+ alt.Chart(per_day_accuracy.reset_index())
226
+ .encode(
227
+ x=alt.X("x-axis-day", axis=alt.Axis(format="%Y-%m-%d"), title=None),
228
+ y=alt.Y("Is Correct", axis=alt.Axis(format=".2f")),
229
+ )
230
+ .interactive()
231
+ )
232
+ st.altair_chart(
233
+ per_day_accuracy_chart.mark_line()
234
+ + per_day_accuracy_chart.transform_loess("x-axis-day", "Is Correct").mark_line(
235
+ color="red", strokeDash=[5, 5]
236
+ ),
237
+ use_container_width=True,
238
+ )
239
+
213
240
  # Chart of cumulative profit per day
214
241
  profit_info = {
215
- "Time": bets_df["Resolved Time"],
242
+ "Time": bets_df[x_axis_column],
216
243
  "Cumulative Profit": bets_df["Profit"].astype(float),
217
244
  }
218
245
  profit_df = pd.DataFrame(profit_info)
@@ -233,8 +260,12 @@ def monitor_agent(agent: DeployedAgent) -> None:
233
260
  )
234
261
 
235
262
  # Table of resolved bets
236
- st.subheader("Resolved Bet History")
237
- st.table(bets_df)
263
+ show_bet_history = st.checkbox(
264
+ "Show resolved bet history", value=False, key=f"{agent.name}_show_bet_history"
265
+ )
266
+ if show_bet_history:
267
+ st.subheader("Resolved Bet History")
268
+ st.table(bets_df.drop(columns=["x-axis-day"]))
238
269
 
239
270
 
240
271
  def monitor_market(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.33.0
3
+ Version: 0.34.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
@@ -35,7 +35,7 @@ Requires-Dist: streamlit (>=1.31.0,<2.0.0)
35
35
  Requires-Dist: subgrounds (>=1.8.1,<2.0.0)
36
36
  Requires-Dist: tabulate (>=0.9.0,<0.10.0)
37
37
  Requires-Dist: tqdm (>=4.66.2,<5.0.0)
38
- Requires-Dist: typer (>=0.9.0,<0.10.0)
38
+ Requires-Dist: typer (>=0.12.3,<0.13.0)
39
39
  Requires-Dist: types-pytz (>=2024.1.0.20240203,<2025.0.0.0)
40
40
  Requires-Dist: types-requests (>=2.31.0.0,<3.0.0.0)
41
41
  Requires-Dist: web3 (>=6.15.1,<7.0.0)
@@ -25,7 +25,7 @@ prediction_market_agent_tooling/markets/categorize.py,sha256=yTd-lDMPW4ESDSzmxeL
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
27
27
  prediction_market_agent_tooling/markets/manifold/api.py,sha256=m6qOzDiyQfxj62Eo_SzzQLkX4ijpi8KtQKGd4CpKAsk,7307
28
- prediction_market_agent_tooling/markets/manifold/data_models.py,sha256=2DZIxwtDp-PH0UWTGiktMFIGAAQoVutI07UsxjNyTyE,5296
28
+ prediction_market_agent_tooling/markets/manifold/data_models.py,sha256=Iw-ajDPYhtfcTfN45nJN_kZShfWcWe9mgzexSWnQCCQ,5295
29
29
  prediction_market_agent_tooling/markets/manifold/manifold.py,sha256=EwRL06E2Y_ZAzr8efwS5yD6p6rnykrcBhqmNDUGZ8Aw,4075
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=w05Oo7yCA2axpCw69Q9y4i9Gcdpht0u5bZGbWqld3rU,2964
@@ -44,7 +44,7 @@ prediction_market_agent_tooling/monitor/langfuse/langfuse_wrapper.py,sha256=b6T6
44
44
  prediction_market_agent_tooling/monitor/markets/manifold.py,sha256=GdYpgRX1GahDi-75Mr53jgtEg6nWcs_rHDUkg4o_7dQ,3352
45
45
  prediction_market_agent_tooling/monitor/markets/omen.py,sha256=jOLPnIbDU9syjnYtHfOb2xa6-Ize3vbplgh-8WWkuT4,3323
46
46
  prediction_market_agent_tooling/monitor/markets/polymarket.py,sha256=I9z9aO1wncyGI3a09ihrw17JkeBKjAuMmC0I9pl_9o4,1781
47
- prediction_market_agent_tooling/monitor/monitor.py,sha256=elvCqCASCd3fOnM7f2kajb_Oy3RMUmGh88jzpworrEU,13387
47
+ prediction_market_agent_tooling/monitor/monitor.py,sha256=uJdaEpGWp4VcejoQLF0uOxhV75AhrXNyWPVG38gBeOo,14505
48
48
  prediction_market_agent_tooling/monitor/monitor_app.py,sha256=rDxgdDJqSK0ARx0TJFMkS76npkHZJz0__Rp0xTpiRok,4611
49
49
  prediction_market_agent_tooling/monitor/monitor_settings.py,sha256=Xiozs3AsufuJ04JOe1vjUri-IAMWHjjmc2ugGGiHNH4,947
50
50
  prediction_market_agent_tooling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -66,8 +66,8 @@ prediction_market_agent_tooling/tools/singleton.py,sha256=CiIELUiI-OeS7U7eeHEt0r
66
66
  prediction_market_agent_tooling/tools/streamlit_user_login.py,sha256=NXEqfjT9Lc9QtliwSGRASIz1opjQ7Btme43H4qJbzgE,3010
67
67
  prediction_market_agent_tooling/tools/utils.py,sha256=zkmwPi3YisgZDPCeNwaRbL8sInOYOkvFgFY4Q8PbEo4,5077
68
68
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=cboATXNmEdn5RmPbVblHOwOdUMKBYrUK3GiI6i6Vzxo,9855
69
- prediction_market_agent_tooling-0.33.0.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
70
- prediction_market_agent_tooling-0.33.0.dist-info/METADATA,sha256=m8GpvhogLrDzkiUsfmt5CV1YBhIdTrgn8bRaVb98kqE,7514
71
- prediction_market_agent_tooling-0.33.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
72
- prediction_market_agent_tooling-0.33.0.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
73
- prediction_market_agent_tooling-0.33.0.dist-info/RECORD,,
69
+ prediction_market_agent_tooling-0.34.0.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
70
+ prediction_market_agent_tooling-0.34.0.dist-info/METADATA,sha256=Ih-qmKV0wWypWJv0ABswvSd1VSPOJBQwDiXw714KSx0,7515
71
+ prediction_market_agent_tooling-0.34.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
72
+ prediction_market_agent_tooling-0.34.0.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
73
+ prediction_market_agent_tooling-0.34.0.dist-info/RECORD,,