cyberosa
commited on
Commit
·
708f2da
1
Parent(s):
a042cec
updating daily data
Browse files- app.py +5 -1
- notebooks/daily_data.ipynb +967 -41
- scripts/metrics.py +8 -5
app.py
CHANGED
@@ -126,7 +126,11 @@ demo = gr.Blocks()
|
|
126 |
weekly_metrics_by_market_creator = compute_weekly_metrics_by_market_creator(
|
127 |
trader_agents_data
|
128 |
)
|
129 |
-
|
|
|
|
|
|
|
|
|
130 |
weekly_agent_metrics_by_market_creator = compute_weekly_metrics_by_market_creator(
|
131 |
trader_agents_data, trader_filter="agent"
|
132 |
)
|
|
|
126 |
weekly_metrics_by_market_creator = compute_weekly_metrics_by_market_creator(
|
127 |
trader_agents_data
|
128 |
)
|
129 |
+
print(
|
130 |
+
weekly_metrics_by_market_creator.loc[
|
131 |
+
weekly_metrics_by_market_creator["market_creator"] == "all"
|
132 |
+
].roi_diff_perc.describe()
|
133 |
+
)
|
134 |
weekly_agent_metrics_by_market_creator = compute_weekly_metrics_by_market_creator(
|
135 |
trader_agents_data, trader_filter="agent"
|
136 |
)
|
notebooks/daily_data.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
@@ -11,7 +11,7 @@
|
|
11 |
},
|
12 |
{
|
13 |
"cell_type": "code",
|
14 |
-
"execution_count":
|
15 |
"metadata": {},
|
16 |
"outputs": [],
|
17 |
"source": [
|
@@ -20,16 +20,426 @@
|
|
20 |
},
|
21 |
{
|
22 |
"cell_type": "code",
|
23 |
-
"execution_count":
|
24 |
"metadata": {},
|
25 |
"outputs": [
|
26 |
{
|
27 |
"data": {
|
28 |
"text/plain": [
|
29 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
]
|
31 |
},
|
32 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
"metadata": {},
|
34 |
"output_type": "execute_result"
|
35 |
}
|
@@ -40,16 +450,16 @@
|
|
40 |
},
|
41 |
{
|
42 |
"cell_type": "code",
|
43 |
-
"execution_count":
|
44 |
"metadata": {},
|
45 |
"outputs": [
|
46 |
{
|
47 |
"data": {
|
48 |
"text/plain": [
|
49 |
-
"Timestamp('2024-09-
|
50 |
]
|
51 |
},
|
52 |
-
"execution_count":
|
53 |
"metadata": {},
|
54 |
"output_type": "execute_result"
|
55 |
}
|
@@ -214,7 +624,7 @@
|
|
214 |
},
|
215 |
{
|
216 |
"cell_type": "code",
|
217 |
-
"execution_count":
|
218 |
"metadata": {},
|
219 |
"outputs": [],
|
220 |
"source": [
|
@@ -223,7 +633,7 @@
|
|
223 |
},
|
224 |
{
|
225 |
"cell_type": "code",
|
226 |
-
"execution_count":
|
227 |
"metadata": {},
|
228 |
"outputs": [
|
229 |
{
|
@@ -231,31 +641,31 @@
|
|
231 |
"output_type": "stream",
|
232 |
"text": [
|
233 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
234 |
-
"RangeIndex:
|
235 |
"Data columns (total 21 columns):\n",
|
236 |
" # Column Non-Null Count Dtype \n",
|
237 |
"--- ------ -------------- ----- \n",
|
238 |
-
" 0 trader_address
|
239 |
-
" 1 market_creator
|
240 |
-
" 2 trade_id
|
241 |
-
" 3 creation_timestamp
|
242 |
-
" 4 title
|
243 |
-
" 5 market_status
|
244 |
-
" 6 collateral_amount
|
245 |
-
" 7 outcome_index
|
246 |
-
" 8 trade_fee_amount
|
247 |
-
" 9 outcomes_tokens_traded
|
248 |
-
" 10 current_answer
|
249 |
-
" 11 is_invalid
|
250 |
-
" 12 winning_trade
|
251 |
-
" 13 earnings
|
252 |
-
" 14 redeemed
|
253 |
-
" 15 redeemed_amount
|
254 |
-
" 16 num_mech_calls
|
255 |
-
" 17 mech_fee_amount
|
256 |
-
" 18 net_earnings
|
257 |
-
" 19 roi
|
258 |
-
" 20 staking
|
259 |
"dtypes: bool(2), datetime64[ns, UTC](1), float64(8), int64(2), object(8)\n",
|
260 |
"memory usage: 1.4+ MB\n"
|
261 |
]
|
@@ -293,16 +703,16 @@
|
|
293 |
},
|
294 |
{
|
295 |
"cell_type": "code",
|
296 |
-
"execution_count":
|
297 |
"metadata": {},
|
298 |
"outputs": [
|
299 |
{
|
300 |
"data": {
|
301 |
"text/plain": [
|
302 |
-
"Timestamp('2024-
|
303 |
]
|
304 |
},
|
305 |
-
"execution_count":
|
306 |
"metadata": {},
|
307 |
"output_type": "execute_result"
|
308 |
}
|
@@ -313,21 +723,21 @@
|
|
313 |
},
|
314 |
{
|
315 |
"cell_type": "code",
|
316 |
-
"execution_count":
|
317 |
"metadata": {},
|
318 |
"outputs": [
|
319 |
{
|
320 |
"data": {
|
321 |
"text/plain": [
|
322 |
"staking\n",
|
323 |
-
"non_agent
|
324 |
-
"quickstart
|
325 |
-
"
|
326 |
-
"
|
327 |
"Name: count, dtype: int64"
|
328 |
]
|
329 |
},
|
330 |
-
"execution_count":
|
331 |
"metadata": {},
|
332 |
"output_type": "execute_result"
|
333 |
}
|
@@ -336,6 +746,522 @@
|
|
336 |
"all_trades_before.staking.value_counts()"
|
337 |
]
|
338 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
{
|
340 |
"cell_type": "code",
|
341 |
"execution_count": 7,
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 23,
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
|
|
11 |
},
|
12 |
{
|
13 |
"cell_type": "code",
|
14 |
+
"execution_count": 24,
|
15 |
"metadata": {},
|
16 |
"outputs": [],
|
17 |
"source": [
|
|
|
20 |
},
|
21 |
{
|
22 |
"cell_type": "code",
|
23 |
+
"execution_count": 15,
|
24 |
"metadata": {},
|
25 |
"outputs": [
|
26 |
{
|
27 |
"data": {
|
28 |
"text/plain": [
|
29 |
+
"Index(['trader_address', 'market_creator', 'trade_id', 'creation_timestamp',\n",
|
30 |
+
" 'title', 'market_status', 'collateral_amount', 'outcome_index',\n",
|
31 |
+
" 'trade_fee_amount', 'outcomes_tokens_traded', 'current_answer',\n",
|
32 |
+
" 'is_invalid', 'winning_trade', 'earnings', 'redeemed',\n",
|
33 |
+
" 'redeemed_amount', 'num_mech_calls', 'mech_fee_amount', 'net_earnings',\n",
|
34 |
+
" 'roi', 'staking', 'nr_mech_calls'],\n",
|
35 |
+
" dtype='object')"
|
36 |
+
]
|
37 |
+
},
|
38 |
+
"execution_count": 15,
|
39 |
+
"metadata": {},
|
40 |
+
"output_type": "execute_result"
|
41 |
+
}
|
42 |
+
],
|
43 |
+
"source": [
|
44 |
+
"all_trades.columns"
|
45 |
+
]
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"cell_type": "code",
|
49 |
+
"execution_count": 32,
|
50 |
+
"metadata": {},
|
51 |
+
"outputs": [
|
52 |
+
{
|
53 |
+
"data": {
|
54 |
+
"text/html": [
|
55 |
+
"<div>\n",
|
56 |
+
"<style scoped>\n",
|
57 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
58 |
+
" vertical-align: middle;\n",
|
59 |
+
" }\n",
|
60 |
+
"\n",
|
61 |
+
" .dataframe tbody tr th {\n",
|
62 |
+
" vertical-align: top;\n",
|
63 |
+
" }\n",
|
64 |
+
"\n",
|
65 |
+
" .dataframe thead th {\n",
|
66 |
+
" text-align: right;\n",
|
67 |
+
" }\n",
|
68 |
+
"</style>\n",
|
69 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
70 |
+
" <thead>\n",
|
71 |
+
" <tr style=\"text-align: right;\">\n",
|
72 |
+
" <th></th>\n",
|
73 |
+
" <th>trader_address</th>\n",
|
74 |
+
" <th>market_creator</th>\n",
|
75 |
+
" <th>trade_id</th>\n",
|
76 |
+
" <th>creation_timestamp</th>\n",
|
77 |
+
" <th>title</th>\n",
|
78 |
+
" <th>market_status</th>\n",
|
79 |
+
" <th>collateral_amount</th>\n",
|
80 |
+
" <th>outcome_index</th>\n",
|
81 |
+
" <th>trade_fee_amount</th>\n",
|
82 |
+
" <th>outcomes_tokens_traded</th>\n",
|
83 |
+
" <th>...</th>\n",
|
84 |
+
" <th>winning_trade</th>\n",
|
85 |
+
" <th>earnings</th>\n",
|
86 |
+
" <th>redeemed</th>\n",
|
87 |
+
" <th>redeemed_amount</th>\n",
|
88 |
+
" <th>num_mech_calls</th>\n",
|
89 |
+
" <th>mech_fee_amount</th>\n",
|
90 |
+
" <th>net_earnings</th>\n",
|
91 |
+
" <th>roi</th>\n",
|
92 |
+
" <th>staking</th>\n",
|
93 |
+
" <th>nr_mech_calls</th>\n",
|
94 |
+
" </tr>\n",
|
95 |
+
" </thead>\n",
|
96 |
+
" <tbody>\n",
|
97 |
+
" <tr>\n",
|
98 |
+
" <th>0</th>\n",
|
99 |
+
" <td>0x01274796ce41aa8e8312e05a427ffb4b0d2148f6</td>\n",
|
100 |
+
" <td>quickstart</td>\n",
|
101 |
+
" <td>0x007068173910cf8719b6f2e66a18b6825c9dde820x01...</td>\n",
|
102 |
+
" <td>2024-10-10 21:43:25+00:00</td>\n",
|
103 |
+
" <td>Will the emergency public warning tests planne...</td>\n",
|
104 |
+
" <td>CLOSED</td>\n",
|
105 |
+
" <td>0.930597</td>\n",
|
106 |
+
" <td>0</td>\n",
|
107 |
+
" <td>0.009306</td>\n",
|
108 |
+
" <td>1.574258</td>\n",
|
109 |
+
" <td>...</td>\n",
|
110 |
+
" <td>True</td>\n",
|
111 |
+
" <td>1.574258</td>\n",
|
112 |
+
" <td>True</td>\n",
|
113 |
+
" <td>1.574258</td>\n",
|
114 |
+
" <td>1</td>\n",
|
115 |
+
" <td>0.01</td>\n",
|
116 |
+
" <td>0.624356</td>\n",
|
117 |
+
" <td>0.657284</td>\n",
|
118 |
+
" <td>non_staking</td>\n",
|
119 |
+
" <td>NaN</td>\n",
|
120 |
+
" </tr>\n",
|
121 |
+
" <tr>\n",
|
122 |
+
" <th>1</th>\n",
|
123 |
+
" <td>0x01274796ce41aa8e8312e05a427ffb4b0d2148f6</td>\n",
|
124 |
+
" <td>quickstart</td>\n",
|
125 |
+
" <td>0x00d659d7749fda4f1c9402182ca5d7ce26cf5cd10x01...</td>\n",
|
126 |
+
" <td>2024-10-18 00:36:50+00:00</td>\n",
|
127 |
+
" <td>Will the Northern Lights be visible over UK sk...</td>\n",
|
128 |
+
" <td>CLOSED</td>\n",
|
129 |
+
" <td>1.375603</td>\n",
|
130 |
+
" <td>1</td>\n",
|
131 |
+
" <td>0.013756</td>\n",
|
132 |
+
" <td>1.942215</td>\n",
|
133 |
+
" <td>...</td>\n",
|
134 |
+
" <td>False</td>\n",
|
135 |
+
" <td>0.000000</td>\n",
|
136 |
+
" <td>False</td>\n",
|
137 |
+
" <td>0.000000</td>\n",
|
138 |
+
" <td>1</td>\n",
|
139 |
+
" <td>0.01</td>\n",
|
140 |
+
" <td>-1.399359</td>\n",
|
141 |
+
" <td>-1.000000</td>\n",
|
142 |
+
" <td>non_staking</td>\n",
|
143 |
+
" <td>NaN</td>\n",
|
144 |
+
" </tr>\n",
|
145 |
+
" <tr>\n",
|
146 |
+
" <th>2</th>\n",
|
147 |
+
" <td>0x01274796ce41aa8e8312e05a427ffb4b0d2148f6</td>\n",
|
148 |
+
" <td>quickstart</td>\n",
|
149 |
+
" <td>0x02ccdf04646d9a55332e67a73e4ffdab2368d05f0x01...</td>\n",
|
150 |
+
" <td>2024-10-23 22:37:35+00:00</td>\n",
|
151 |
+
" <td>Will any Republican lawmakers introduce legisl...</td>\n",
|
152 |
+
" <td>CLOSED</td>\n",
|
153 |
+
" <td>0.471695</td>\n",
|
154 |
+
" <td>1</td>\n",
|
155 |
+
" <td>0.004717</td>\n",
|
156 |
+
" <td>0.784784</td>\n",
|
157 |
+
" <td>...</td>\n",
|
158 |
+
" <td>True</td>\n",
|
159 |
+
" <td>0.784784</td>\n",
|
160 |
+
" <td>True</td>\n",
|
161 |
+
" <td>0.784784</td>\n",
|
162 |
+
" <td>1</td>\n",
|
163 |
+
" <td>0.01</td>\n",
|
164 |
+
" <td>0.298372</td>\n",
|
165 |
+
" <td>0.613414</td>\n",
|
166 |
+
" <td>non_staking</td>\n",
|
167 |
+
" <td>NaN</td>\n",
|
168 |
+
" </tr>\n",
|
169 |
+
" <tr>\n",
|
170 |
+
" <th>3</th>\n",
|
171 |
+
" <td>0x01274796ce41aa8e8312e05a427ffb4b0d2148f6</td>\n",
|
172 |
+
" <td>quickstart</td>\n",
|
173 |
+
" <td>0x09f47ce8995abf1d5b91f2cbfa940ede2fb954c30x01...</td>\n",
|
174 |
+
" <td>2024-10-20 23:58:35+00:00</td>\n",
|
175 |
+
" <td>Will any new major AI-driven fraud detection t...</td>\n",
|
176 |
+
" <td>CLOSED</td>\n",
|
177 |
+
" <td>0.289046</td>\n",
|
178 |
+
" <td>1</td>\n",
|
179 |
+
" <td>0.002890</td>\n",
|
180 |
+
" <td>0.445590</td>\n",
|
181 |
+
" <td>...</td>\n",
|
182 |
+
" <td>False</td>\n",
|
183 |
+
" <td>0.000000</td>\n",
|
184 |
+
" <td>False</td>\n",
|
185 |
+
" <td>0.000000</td>\n",
|
186 |
+
" <td>5</td>\n",
|
187 |
+
" <td>0.05</td>\n",
|
188 |
+
" <td>-0.341936</td>\n",
|
189 |
+
" <td>-1.000000</td>\n",
|
190 |
+
" <td>non_staking</td>\n",
|
191 |
+
" <td>NaN</td>\n",
|
192 |
+
" </tr>\n",
|
193 |
+
" <tr>\n",
|
194 |
+
" <th>4</th>\n",
|
195 |
+
" <td>0x01274796ce41aa8e8312e05a427ffb4b0d2148f6</td>\n",
|
196 |
+
" <td>quickstart</td>\n",
|
197 |
+
" <td>0x0c86942c52740316bbdb70303c5aaee40876d8ce0x01...</td>\n",
|
198 |
+
" <td>2024-10-24 22:42:00+00:00</td>\n",
|
199 |
+
" <td>Will any new norovirus vaccine trial sites be ...</td>\n",
|
200 |
+
" <td>CLOSED</td>\n",
|
201 |
+
" <td>0.286552</td>\n",
|
202 |
+
" <td>1</td>\n",
|
203 |
+
" <td>0.002866</td>\n",
|
204 |
+
" <td>0.470457</td>\n",
|
205 |
+
" <td>...</td>\n",
|
206 |
+
" <td>True</td>\n",
|
207 |
+
" <td>0.470457</td>\n",
|
208 |
+
" <td>True</td>\n",
|
209 |
+
" <td>0.470457</td>\n",
|
210 |
+
" <td>1</td>\n",
|
211 |
+
" <td>0.01</td>\n",
|
212 |
+
" <td>0.171040</td>\n",
|
213 |
+
" <td>0.571242</td>\n",
|
214 |
+
" <td>non_staking</td>\n",
|
215 |
+
" <td>NaN</td>\n",
|
216 |
+
" </tr>\n",
|
217 |
+
" </tbody>\n",
|
218 |
+
"</table>\n",
|
219 |
+
"<p>5 rows × 22 columns</p>\n",
|
220 |
+
"</div>"
|
221 |
+
],
|
222 |
+
"text/plain": [
|
223 |
+
" trader_address market_creator \\\n",
|
224 |
+
"0 0x01274796ce41aa8e8312e05a427ffb4b0d2148f6 quickstart \n",
|
225 |
+
"1 0x01274796ce41aa8e8312e05a427ffb4b0d2148f6 quickstart \n",
|
226 |
+
"2 0x01274796ce41aa8e8312e05a427ffb4b0d2148f6 quickstart \n",
|
227 |
+
"3 0x01274796ce41aa8e8312e05a427ffb4b0d2148f6 quickstart \n",
|
228 |
+
"4 0x01274796ce41aa8e8312e05a427ffb4b0d2148f6 quickstart \n",
|
229 |
+
"\n",
|
230 |
+
" trade_id \\\n",
|
231 |
+
"0 0x007068173910cf8719b6f2e66a18b6825c9dde820x01... \n",
|
232 |
+
"1 0x00d659d7749fda4f1c9402182ca5d7ce26cf5cd10x01... \n",
|
233 |
+
"2 0x02ccdf04646d9a55332e67a73e4ffdab2368d05f0x01... \n",
|
234 |
+
"3 0x09f47ce8995abf1d5b91f2cbfa940ede2fb954c30x01... \n",
|
235 |
+
"4 0x0c86942c52740316bbdb70303c5aaee40876d8ce0x01... \n",
|
236 |
+
"\n",
|
237 |
+
" creation_timestamp \\\n",
|
238 |
+
"0 2024-10-10 21:43:25+00:00 \n",
|
239 |
+
"1 2024-10-18 00:36:50+00:00 \n",
|
240 |
+
"2 2024-10-23 22:37:35+00:00 \n",
|
241 |
+
"3 2024-10-20 23:58:35+00:00 \n",
|
242 |
+
"4 2024-10-24 22:42:00+00:00 \n",
|
243 |
+
"\n",
|
244 |
+
" title market_status \\\n",
|
245 |
+
"0 Will the emergency public warning tests planne... CLOSED \n",
|
246 |
+
"1 Will the Northern Lights be visible over UK sk... CLOSED \n",
|
247 |
+
"2 Will any Republican lawmakers introduce legisl... CLOSED \n",
|
248 |
+
"3 Will any new major AI-driven fraud detection t... CLOSED \n",
|
249 |
+
"4 Will any new norovirus vaccine trial sites be ... CLOSED \n",
|
250 |
+
"\n",
|
251 |
+
" collateral_amount outcome_index trade_fee_amount outcomes_tokens_traded \\\n",
|
252 |
+
"0 0.930597 0 0.009306 1.574258 \n",
|
253 |
+
"1 1.375603 1 0.013756 1.942215 \n",
|
254 |
+
"2 0.471695 1 0.004717 0.784784 \n",
|
255 |
+
"3 0.289046 1 0.002890 0.445590 \n",
|
256 |
+
"4 0.286552 1 0.002866 0.470457 \n",
|
257 |
+
"\n",
|
258 |
+
" ... winning_trade earnings redeemed redeemed_amount num_mech_calls \\\n",
|
259 |
+
"0 ... True 1.574258 True 1.574258 1 \n",
|
260 |
+
"1 ... False 0.000000 False 0.000000 1 \n",
|
261 |
+
"2 ... True 0.784784 True 0.784784 1 \n",
|
262 |
+
"3 ... False 0.000000 False 0.000000 5 \n",
|
263 |
+
"4 ... True 0.470457 True 0.470457 1 \n",
|
264 |
+
"\n",
|
265 |
+
" mech_fee_amount net_earnings roi staking nr_mech_calls \n",
|
266 |
+
"0 0.01 0.624356 0.657284 non_staking NaN \n",
|
267 |
+
"1 0.01 -1.399359 -1.000000 non_staking NaN \n",
|
268 |
+
"2 0.01 0.298372 0.613414 non_staking NaN \n",
|
269 |
+
"3 0.05 -0.341936 -1.000000 non_staking NaN \n",
|
270 |
+
"4 0.01 0.171040 0.571242 non_staking NaN \n",
|
271 |
+
"\n",
|
272 |
+
"[5 rows x 22 columns]"
|
273 |
]
|
274 |
},
|
275 |
+
"execution_count": 32,
|
276 |
+
"metadata": {},
|
277 |
+
"output_type": "execute_result"
|
278 |
+
}
|
279 |
+
],
|
280 |
+
"source": [
|
281 |
+
"all_trades.head()"
|
282 |
+
]
|
283 |
+
},
|
284 |
+
{
|
285 |
+
"cell_type": "code",
|
286 |
+
"execution_count": 16,
|
287 |
+
"metadata": {},
|
288 |
+
"outputs": [
|
289 |
+
{
|
290 |
+
"data": {
|
291 |
+
"text/plain": [
|
292 |
+
"pandas.core.series.Series"
|
293 |
+
]
|
294 |
+
},
|
295 |
+
"execution_count": 16,
|
296 |
+
"metadata": {},
|
297 |
+
"output_type": "execute_result"
|
298 |
+
}
|
299 |
+
],
|
300 |
+
"source": [
|
301 |
+
"type(all_trades.creation_timestamp)"
|
302 |
+
]
|
303 |
+
},
|
304 |
+
{
|
305 |
+
"cell_type": "code",
|
306 |
+
"execution_count": 17,
|
307 |
+
"metadata": {},
|
308 |
+
"outputs": [
|
309 |
+
{
|
310 |
+
"data": {
|
311 |
+
"text/plain": [
|
312 |
+
"pandas._libs.tslibs.timestamps.Timestamp"
|
313 |
+
]
|
314 |
+
},
|
315 |
+
"execution_count": 17,
|
316 |
+
"metadata": {},
|
317 |
+
"output_type": "execute_result"
|
318 |
+
}
|
319 |
+
],
|
320 |
+
"source": [
|
321 |
+
"type(all_trades.creation_timestamp.iloc[0])"
|
322 |
+
]
|
323 |
+
},
|
324 |
+
{
|
325 |
+
"cell_type": "code",
|
326 |
+
"execution_count": 18,
|
327 |
+
"metadata": {},
|
328 |
+
"outputs": [
|
329 |
+
{
|
330 |
+
"name": "stderr",
|
331 |
+
"output_type": "stream",
|
332 |
+
"text": [
|
333 |
+
"/var/folders/gp/02mb1d514ng739czlxw1lhh00000gn/T/ipykernel_69783/1320555996.py:2: UserWarning: Converting to PeriodArray/Index representation will drop timezone information.\n",
|
334 |
+
" all_trades[\"creation_timestamp\"].dt.to_period(\"W\").dt.strftime(\"%b-%d\")\n"
|
335 |
+
]
|
336 |
+
}
|
337 |
+
],
|
338 |
+
"source": [
|
339 |
+
"all_trades[\"month_year_week\"] = (\n",
|
340 |
+
" all_trades[\"creation_timestamp\"].dt.to_period(\"W\").dt.strftime(\"%b-%d\")\n",
|
341 |
+
")"
|
342 |
+
]
|
343 |
+
},
|
344 |
+
{
|
345 |
+
"cell_type": "code",
|
346 |
+
"execution_count": 20,
|
347 |
+
"metadata": {},
|
348 |
+
"outputs": [
|
349 |
+
{
|
350 |
+
"name": "stderr",
|
351 |
+
"output_type": "stream",
|
352 |
+
"text": [
|
353 |
+
"/var/folders/gp/02mb1d514ng739czlxw1lhh00000gn/T/ipykernel_69783/353897105.py:2: UserWarning: Converting to PeriodArray/Index representation will drop timezone information.\n",
|
354 |
+
" all_trades[\"creation_timestamp\"].dt.to_period(\"W\")\n"
|
355 |
+
]
|
356 |
+
}
|
357 |
+
],
|
358 |
+
"source": [
|
359 |
+
"all_trades[\"month_year_week\"] = (\n",
|
360 |
+
" all_trades[\"creation_timestamp\"].dt.to_period(\"W\")\n",
|
361 |
+
")"
|
362 |
+
]
|
363 |
+
},
|
364 |
+
{
|
365 |
+
"cell_type": "code",
|
366 |
+
"execution_count": 21,
|
367 |
+
"metadata": {},
|
368 |
+
"outputs": [
|
369 |
+
{
|
370 |
+
"data": {
|
371 |
+
"text/plain": [
|
372 |
+
"pandas._libs.tslibs.period.Period"
|
373 |
+
]
|
374 |
+
},
|
375 |
+
"execution_count": 21,
|
376 |
+
"metadata": {},
|
377 |
+
"output_type": "execute_result"
|
378 |
+
}
|
379 |
+
],
|
380 |
+
"source": [
|
381 |
+
"type(all_trades.month_year_week.iloc[0])"
|
382 |
+
]
|
383 |
+
},
|
384 |
+
{
|
385 |
+
"cell_type": "code",
|
386 |
+
"execution_count": null,
|
387 |
+
"metadata": {},
|
388 |
+
"outputs": [],
|
389 |
+
"source": []
|
390 |
+
},
|
391 |
+
{
|
392 |
+
"cell_type": "code",
|
393 |
+
"execution_count": 22,
|
394 |
+
"metadata": {},
|
395 |
+
"outputs": [
|
396 |
+
{
|
397 |
+
"data": {
|
398 |
+
"text/plain": [
|
399 |
+
"Period('2024-10-07/2024-10-13', 'W-SUN')"
|
400 |
+
]
|
401 |
+
},
|
402 |
+
"execution_count": 22,
|
403 |
+
"metadata": {},
|
404 |
+
"output_type": "execute_result"
|
405 |
+
}
|
406 |
+
],
|
407 |
+
"source": [
|
408 |
+
"all_trades.month_year_week.iloc[0]"
|
409 |
+
]
|
410 |
+
},
|
411 |
+
{
|
412 |
+
"cell_type": "code",
|
413 |
+
"execution_count": 34,
|
414 |
+
"metadata": {},
|
415 |
+
"outputs": [
|
416 |
+
{
|
417 |
+
"data": {
|
418 |
+
"text/plain": [
|
419 |
+
"pandas._libs.tslibs.timestamps.Timestamp"
|
420 |
+
]
|
421 |
+
},
|
422 |
+
"execution_count": 34,
|
423 |
+
"metadata": {},
|
424 |
+
"output_type": "execute_result"
|
425 |
+
}
|
426 |
+
],
|
427 |
+
"source": [
|
428 |
+
"type(all_trades.iloc[0].creation_timestamp)"
|
429 |
+
]
|
430 |
+
},
|
431 |
+
{
|
432 |
+
"cell_type": "code",
|
433 |
+
"execution_count": 8,
|
434 |
+
"metadata": {},
|
435 |
+
"outputs": [
|
436 |
+
{
|
437 |
+
"data": {
|
438 |
+
"text/plain": [
|
439 |
+
"Timestamp('2024-11-27 01:45:05+0000', tz='UTC')"
|
440 |
+
]
|
441 |
+
},
|
442 |
+
"execution_count": 8,
|
443 |
"metadata": {},
|
444 |
"output_type": "execute_result"
|
445 |
}
|
|
|
450 |
},
|
451 |
{
|
452 |
"cell_type": "code",
|
453 |
+
"execution_count": 9,
|
454 |
"metadata": {},
|
455 |
"outputs": [
|
456 |
{
|
457 |
"data": {
|
458 |
"text/plain": [
|
459 |
+
"Timestamp('2024-09-29 00:02:45+0000', tz='UTC')"
|
460 |
]
|
461 |
},
|
462 |
+
"execution_count": 9,
|
463 |
"metadata": {},
|
464 |
"output_type": "execute_result"
|
465 |
}
|
|
|
624 |
},
|
625 |
{
|
626 |
"cell_type": "code",
|
627 |
+
"execution_count": 25,
|
628 |
"metadata": {},
|
629 |
"outputs": [],
|
630 |
"source": [
|
|
|
633 |
},
|
634 |
{
|
635 |
"cell_type": "code",
|
636 |
+
"execution_count": 26,
|
637 |
"metadata": {},
|
638 |
"outputs": [
|
639 |
{
|
|
|
641 |
"output_type": "stream",
|
642 |
"text": [
|
643 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
644 |
+
"RangeIndex: 9686 entries, 0 to 9685\n",
|
645 |
"Data columns (total 21 columns):\n",
|
646 |
" # Column Non-Null Count Dtype \n",
|
647 |
"--- ------ -------------- ----- \n",
|
648 |
+
" 0 trader_address 9686 non-null object \n",
|
649 |
+
" 1 market_creator 9686 non-null object \n",
|
650 |
+
" 2 trade_id 9686 non-null object \n",
|
651 |
+
" 3 creation_timestamp 9686 non-null datetime64[ns, UTC]\n",
|
652 |
+
" 4 title 9686 non-null object \n",
|
653 |
+
" 5 market_status 9686 non-null object \n",
|
654 |
+
" 6 collateral_amount 9686 non-null float64 \n",
|
655 |
+
" 7 outcome_index 9686 non-null object \n",
|
656 |
+
" 8 trade_fee_amount 9686 non-null float64 \n",
|
657 |
+
" 9 outcomes_tokens_traded 9686 non-null float64 \n",
|
658 |
+
" 10 current_answer 671 non-null float64 \n",
|
659 |
+
" 11 is_invalid 9686 non-null bool \n",
|
660 |
+
" 12 winning_trade 671 non-null object \n",
|
661 |
+
" 13 earnings 9686 non-null float64 \n",
|
662 |
+
" 14 redeemed 9686 non-null bool \n",
|
663 |
+
" 15 redeemed_amount 9686 non-null int64 \n",
|
664 |
+
" 16 num_mech_calls 9686 non-null int64 \n",
|
665 |
+
" 17 mech_fee_amount 9686 non-null float64 \n",
|
666 |
+
" 18 net_earnings 9686 non-null float64 \n",
|
667 |
+
" 19 roi 9686 non-null float64 \n",
|
668 |
+
" 20 staking 9686 non-null object \n",
|
669 |
"dtypes: bool(2), datetime64[ns, UTC](1), float64(8), int64(2), object(8)\n",
|
670 |
"memory usage: 1.4+ MB\n"
|
671 |
]
|
|
|
703 |
},
|
704 |
{
|
705 |
"cell_type": "code",
|
706 |
+
"execution_count": 28,
|
707 |
"metadata": {},
|
708 |
"outputs": [
|
709 |
{
|
710 |
"data": {
|
711 |
"text/plain": [
|
712 |
+
"Timestamp('2024-12-02 17:30:05+0000', tz='UTC')"
|
713 |
]
|
714 |
},
|
715 |
+
"execution_count": 28,
|
716 |
"metadata": {},
|
717 |
"output_type": "execute_result"
|
718 |
}
|
|
|
723 |
},
|
724 |
{
|
725 |
"cell_type": "code",
|
726 |
+
"execution_count": 29,
|
727 |
"metadata": {},
|
728 |
"outputs": [
|
729 |
{
|
730 |
"data": {
|
731 |
"text/plain": [
|
732 |
"staking\n",
|
733 |
+
"non_agent 6140\n",
|
734 |
+
"quickstart 1920\n",
|
735 |
+
"non_staking 1024\n",
|
736 |
+
"pearl 602\n",
|
737 |
"Name: count, dtype: int64"
|
738 |
]
|
739 |
},
|
740 |
+
"execution_count": 29,
|
741 |
"metadata": {},
|
742 |
"output_type": "execute_result"
|
743 |
}
|
|
|
746 |
"all_trades_before.staking.value_counts()"
|
747 |
]
|
748 |
},
|
749 |
+
{
|
750 |
+
"cell_type": "code",
|
751 |
+
"execution_count": 30,
|
752 |
+
"metadata": {},
|
753 |
+
"outputs": [
|
754 |
+
{
|
755 |
+
"data": {
|
756 |
+
"text/plain": [
|
757 |
+
"count 9686.0\n",
|
758 |
+
"mean 0.0\n",
|
759 |
+
"std 0.0\n",
|
760 |
+
"min 0.0\n",
|
761 |
+
"25% 0.0\n",
|
762 |
+
"50% 0.0\n",
|
763 |
+
"75% 0.0\n",
|
764 |
+
"max 0.0\n",
|
765 |
+
"Name: num_mech_calls, dtype: float64"
|
766 |
+
]
|
767 |
+
},
|
768 |
+
"execution_count": 30,
|
769 |
+
"metadata": {},
|
770 |
+
"output_type": "execute_result"
|
771 |
+
}
|
772 |
+
],
|
773 |
+
"source": [
|
774 |
+
"all_trades_before.num_mech_calls.describe()"
|
775 |
+
]
|
776 |
+
},
|
777 |
+
{
|
778 |
+
"cell_type": "code",
|
779 |
+
"execution_count": 33,
|
780 |
+
"metadata": {},
|
781 |
+
"outputs": [
|
782 |
+
{
|
783 |
+
"data": {
|
784 |
+
"text/html": [
|
785 |
+
"<div>\n",
|
786 |
+
"<style scoped>\n",
|
787 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
788 |
+
" vertical-align: middle;\n",
|
789 |
+
" }\n",
|
790 |
+
"\n",
|
791 |
+
" .dataframe tbody tr th {\n",
|
792 |
+
" vertical-align: top;\n",
|
793 |
+
" }\n",
|
794 |
+
"\n",
|
795 |
+
" .dataframe thead th {\n",
|
796 |
+
" text-align: right;\n",
|
797 |
+
" }\n",
|
798 |
+
"</style>\n",
|
799 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
800 |
+
" <thead>\n",
|
801 |
+
" <tr style=\"text-align: right;\">\n",
|
802 |
+
" <th></th>\n",
|
803 |
+
" <th>trader_address</th>\n",
|
804 |
+
" <th>market_creator</th>\n",
|
805 |
+
" <th>trade_id</th>\n",
|
806 |
+
" <th>creation_timestamp</th>\n",
|
807 |
+
" <th>title</th>\n",
|
808 |
+
" <th>market_status</th>\n",
|
809 |
+
" <th>collateral_amount</th>\n",
|
810 |
+
" <th>outcome_index</th>\n",
|
811 |
+
" <th>trade_fee_amount</th>\n",
|
812 |
+
" <th>outcomes_tokens_traded</th>\n",
|
813 |
+
" <th>...</th>\n",
|
814 |
+
" <th>is_invalid</th>\n",
|
815 |
+
" <th>winning_trade</th>\n",
|
816 |
+
" <th>earnings</th>\n",
|
817 |
+
" <th>redeemed</th>\n",
|
818 |
+
" <th>redeemed_amount</th>\n",
|
819 |
+
" <th>num_mech_calls</th>\n",
|
820 |
+
" <th>mech_fee_amount</th>\n",
|
821 |
+
" <th>net_earnings</th>\n",
|
822 |
+
" <th>roi</th>\n",
|
823 |
+
" <th>staking</th>\n",
|
824 |
+
" </tr>\n",
|
825 |
+
" </thead>\n",
|
826 |
+
" <tbody>\n",
|
827 |
+
" <tr>\n",
|
828 |
+
" <th>8778</th>\n",
|
829 |
+
" <td>0x047f8663b254d90d28af6d8ca7181947e94577ce</td>\n",
|
830 |
+
" <td>pearl</td>\n",
|
831 |
+
" <td>0x2379c39b63aa1a3e37d4a7e4b909a699b4c14a810x04...</td>\n",
|
832 |
+
" <td>2024-11-30 16:57:40+00:00</td>\n",
|
833 |
+
" <td>Will the IAEA issue a formal statement regardi...</td>\n",
|
834 |
+
" <td>OPEN</td>\n",
|
835 |
+
" <td>0.025</td>\n",
|
836 |
+
" <td>0</td>\n",
|
837 |
+
" <td>0.00025</td>\n",
|
838 |
+
" <td>0.047923</td>\n",
|
839 |
+
" <td>...</td>\n",
|
840 |
+
" <td>False</td>\n",
|
841 |
+
" <td>None</td>\n",
|
842 |
+
" <td>0.0</td>\n",
|
843 |
+
" <td>False</td>\n",
|
844 |
+
" <td>0</td>\n",
|
845 |
+
" <td>0</td>\n",
|
846 |
+
" <td>0.0</td>\n",
|
847 |
+
" <td>-0.02525</td>\n",
|
848 |
+
" <td>-1.0</td>\n",
|
849 |
+
" <td>pearl</td>\n",
|
850 |
+
" </tr>\n",
|
851 |
+
" <tr>\n",
|
852 |
+
" <th>8779</th>\n",
|
853 |
+
" <td>0x047f8663b254d90d28af6d8ca7181947e94577ce</td>\n",
|
854 |
+
" <td>pearl</td>\n",
|
855 |
+
" <td>0xbb96f5a99bf452aa202fea0b36b0910734377d450x04...</td>\n",
|
856 |
+
" <td>2024-11-30 16:45:25+00:00</td>\n",
|
857 |
+
" <td>Will the IAEA confirm Iran has started feeding...</td>\n",
|
858 |
+
" <td>OPEN</td>\n",
|
859 |
+
" <td>0.025</td>\n",
|
860 |
+
" <td>0</td>\n",
|
861 |
+
" <td>0.00025</td>\n",
|
862 |
+
" <td>0.049461</td>\n",
|
863 |
+
" <td>...</td>\n",
|
864 |
+
" <td>False</td>\n",
|
865 |
+
" <td>None</td>\n",
|
866 |
+
" <td>0.0</td>\n",
|
867 |
+
" <td>False</td>\n",
|
868 |
+
" <td>0</td>\n",
|
869 |
+
" <td>0</td>\n",
|
870 |
+
" <td>0.0</td>\n",
|
871 |
+
" <td>-0.02525</td>\n",
|
872 |
+
" <td>-1.0</td>\n",
|
873 |
+
" <td>pearl</td>\n",
|
874 |
+
" </tr>\n",
|
875 |
+
" <tr>\n",
|
876 |
+
" <th>8780</th>\n",
|
877 |
+
" <td>0x047f8663b254d90d28af6d8ca7181947e94577ce</td>\n",
|
878 |
+
" <td>pearl</td>\n",
|
879 |
+
" <td>0xcd34c44c5f944bcf05f958e5d25960f8fcda664b0x04...</td>\n",
|
880 |
+
" <td>2024-12-01 18:38:40+00:00</td>\n",
|
881 |
+
" <td>Will Iran install more than 6,000 new centrifu...</td>\n",
|
882 |
+
" <td>OPEN</td>\n",
|
883 |
+
" <td>0.025</td>\n",
|
884 |
+
" <td>1</td>\n",
|
885 |
+
" <td>0.00025</td>\n",
|
886 |
+
" <td>0.046737</td>\n",
|
887 |
+
" <td>...</td>\n",
|
888 |
+
" <td>False</td>\n",
|
889 |
+
" <td>None</td>\n",
|
890 |
+
" <td>0.0</td>\n",
|
891 |
+
" <td>False</td>\n",
|
892 |
+
" <td>0</td>\n",
|
893 |
+
" <td>0</td>\n",
|
894 |
+
" <td>0.0</td>\n",
|
895 |
+
" <td>-0.02525</td>\n",
|
896 |
+
" <td>-1.0</td>\n",
|
897 |
+
" <td>pearl</td>\n",
|
898 |
+
" </tr>\n",
|
899 |
+
" <tr>\n",
|
900 |
+
" <th>8781</th>\n",
|
901 |
+
" <td>0x047f8663b254d90d28af6d8ca7181947e94577ce</td>\n",
|
902 |
+
" <td>pearl</td>\n",
|
903 |
+
" <td>0xff1d1569a94ebad89612213f083a3cb948415f740x04...</td>\n",
|
904 |
+
" <td>2024-11-30 17:00:30+00:00</td>\n",
|
905 |
+
" <td>Will Rivian's stock price increase by at least...</td>\n",
|
906 |
+
" <td>OPEN</td>\n",
|
907 |
+
" <td>0.025</td>\n",
|
908 |
+
" <td>0</td>\n",
|
909 |
+
" <td>0.00025</td>\n",
|
910 |
+
" <td>0.047316</td>\n",
|
911 |
+
" <td>...</td>\n",
|
912 |
+
" <td>False</td>\n",
|
913 |
+
" <td>None</td>\n",
|
914 |
+
" <td>0.0</td>\n",
|
915 |
+
" <td>False</td>\n",
|
916 |
+
" <td>0</td>\n",
|
917 |
+
" <td>0</td>\n",
|
918 |
+
" <td>0.0</td>\n",
|
919 |
+
" <td>-0.02525</td>\n",
|
920 |
+
" <td>-1.0</td>\n",
|
921 |
+
" <td>pearl</td>\n",
|
922 |
+
" </tr>\n",
|
923 |
+
" <tr>\n",
|
924 |
+
" <th>8782</th>\n",
|
925 |
+
" <td>0x06d873e7465a6680f5487905d7b5daf7f2c6e299</td>\n",
|
926 |
+
" <td>pearl</td>\n",
|
927 |
+
" <td>0x2379c39b63aa1a3e37d4a7e4b909a699b4c14a810x06...</td>\n",
|
928 |
+
" <td>2024-12-02 17:07:05+00:00</td>\n",
|
929 |
+
" <td>Will the IAEA issue a formal statement regardi...</td>\n",
|
930 |
+
" <td>OPEN</td>\n",
|
931 |
+
" <td>0.025</td>\n",
|
932 |
+
" <td>0</td>\n",
|
933 |
+
" <td>0.00025</td>\n",
|
934 |
+
" <td>0.043896</td>\n",
|
935 |
+
" <td>...</td>\n",
|
936 |
+
" <td>False</td>\n",
|
937 |
+
" <td>None</td>\n",
|
938 |
+
" <td>0.0</td>\n",
|
939 |
+
" <td>False</td>\n",
|
940 |
+
" <td>0</td>\n",
|
941 |
+
" <td>0</td>\n",
|
942 |
+
" <td>0.0</td>\n",
|
943 |
+
" <td>-0.02525</td>\n",
|
944 |
+
" <td>-1.0</td>\n",
|
945 |
+
" <td>pearl</td>\n",
|
946 |
+
" </tr>\n",
|
947 |
+
" </tbody>\n",
|
948 |
+
"</table>\n",
|
949 |
+
"<p>5 rows × 21 columns</p>\n",
|
950 |
+
"</div>"
|
951 |
+
],
|
952 |
+
"text/plain": [
|
953 |
+
" trader_address market_creator \\\n",
|
954 |
+
"8778 0x047f8663b254d90d28af6d8ca7181947e94577ce pearl \n",
|
955 |
+
"8779 0x047f8663b254d90d28af6d8ca7181947e94577ce pearl \n",
|
956 |
+
"8780 0x047f8663b254d90d28af6d8ca7181947e94577ce pearl \n",
|
957 |
+
"8781 0x047f8663b254d90d28af6d8ca7181947e94577ce pearl \n",
|
958 |
+
"8782 0x06d873e7465a6680f5487905d7b5daf7f2c6e299 pearl \n",
|
959 |
+
"\n",
|
960 |
+
" trade_id \\\n",
|
961 |
+
"8778 0x2379c39b63aa1a3e37d4a7e4b909a699b4c14a810x04... \n",
|
962 |
+
"8779 0xbb96f5a99bf452aa202fea0b36b0910734377d450x04... \n",
|
963 |
+
"8780 0xcd34c44c5f944bcf05f958e5d25960f8fcda664b0x04... \n",
|
964 |
+
"8781 0xff1d1569a94ebad89612213f083a3cb948415f740x04... \n",
|
965 |
+
"8782 0x2379c39b63aa1a3e37d4a7e4b909a699b4c14a810x06... \n",
|
966 |
+
"\n",
|
967 |
+
" creation_timestamp \\\n",
|
968 |
+
"8778 2024-11-30 16:57:40+00:00 \n",
|
969 |
+
"8779 2024-11-30 16:45:25+00:00 \n",
|
970 |
+
"8780 2024-12-01 18:38:40+00:00 \n",
|
971 |
+
"8781 2024-11-30 17:00:30+00:00 \n",
|
972 |
+
"8782 2024-12-02 17:07:05+00:00 \n",
|
973 |
+
"\n",
|
974 |
+
" title market_status \\\n",
|
975 |
+
"8778 Will the IAEA issue a formal statement regardi... OPEN \n",
|
976 |
+
"8779 Will the IAEA confirm Iran has started feeding... OPEN \n",
|
977 |
+
"8780 Will Iran install more than 6,000 new centrifu... OPEN \n",
|
978 |
+
"8781 Will Rivian's stock price increase by at least... OPEN \n",
|
979 |
+
"8782 Will the IAEA issue a formal statement regardi... OPEN \n",
|
980 |
+
"\n",
|
981 |
+
" collateral_amount outcome_index trade_fee_amount \\\n",
|
982 |
+
"8778 0.025 0 0.00025 \n",
|
983 |
+
"8779 0.025 0 0.00025 \n",
|
984 |
+
"8780 0.025 1 0.00025 \n",
|
985 |
+
"8781 0.025 0 0.00025 \n",
|
986 |
+
"8782 0.025 0 0.00025 \n",
|
987 |
+
"\n",
|
988 |
+
" outcomes_tokens_traded ... is_invalid winning_trade earnings \\\n",
|
989 |
+
"8778 0.047923 ... False None 0.0 \n",
|
990 |
+
"8779 0.049461 ... False None 0.0 \n",
|
991 |
+
"8780 0.046737 ... False None 0.0 \n",
|
992 |
+
"8781 0.047316 ... False None 0.0 \n",
|
993 |
+
"8782 0.043896 ... False None 0.0 \n",
|
994 |
+
"\n",
|
995 |
+
" redeemed redeemed_amount num_mech_calls mech_fee_amount \\\n",
|
996 |
+
"8778 False 0 0 0.0 \n",
|
997 |
+
"8779 False 0 0 0.0 \n",
|
998 |
+
"8780 False 0 0 0.0 \n",
|
999 |
+
"8781 False 0 0 0.0 \n",
|
1000 |
+
"8782 False 0 0 0.0 \n",
|
1001 |
+
"\n",
|
1002 |
+
" net_earnings roi staking \n",
|
1003 |
+
"8778 -0.02525 -1.0 pearl \n",
|
1004 |
+
"8779 -0.02525 -1.0 pearl \n",
|
1005 |
+
"8780 -0.02525 -1.0 pearl \n",
|
1006 |
+
"8781 -0.02525 -1.0 pearl \n",
|
1007 |
+
"8782 -0.02525 -1.0 pearl \n",
|
1008 |
+
"\n",
|
1009 |
+
"[5 rows x 21 columns]"
|
1010 |
+
]
|
1011 |
+
},
|
1012 |
+
"execution_count": 33,
|
1013 |
+
"metadata": {},
|
1014 |
+
"output_type": "execute_result"
|
1015 |
+
}
|
1016 |
+
],
|
1017 |
+
"source": [
|
1018 |
+
"all_trades_before.loc[all_trades_before[\"staking\"]==\"pearl\"].head()"
|
1019 |
+
]
|
1020 |
+
},
|
1021 |
+
{
|
1022 |
+
"cell_type": "code",
|
1023 |
+
"execution_count": 31,
|
1024 |
+
"metadata": {},
|
1025 |
+
"outputs": [
|
1026 |
+
{
|
1027 |
+
"data": {
|
1028 |
+
"text/html": [
|
1029 |
+
"<div>\n",
|
1030 |
+
"<style scoped>\n",
|
1031 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
1032 |
+
" vertical-align: middle;\n",
|
1033 |
+
" }\n",
|
1034 |
+
"\n",
|
1035 |
+
" .dataframe tbody tr th {\n",
|
1036 |
+
" vertical-align: top;\n",
|
1037 |
+
" }\n",
|
1038 |
+
"\n",
|
1039 |
+
" .dataframe thead th {\n",
|
1040 |
+
" text-align: right;\n",
|
1041 |
+
" }\n",
|
1042 |
+
"</style>\n",
|
1043 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
1044 |
+
" <thead>\n",
|
1045 |
+
" <tr style=\"text-align: right;\">\n",
|
1046 |
+
" <th></th>\n",
|
1047 |
+
" <th>trader_address</th>\n",
|
1048 |
+
" <th>market_creator</th>\n",
|
1049 |
+
" <th>trade_id</th>\n",
|
1050 |
+
" <th>creation_timestamp</th>\n",
|
1051 |
+
" <th>title</th>\n",
|
1052 |
+
" <th>market_status</th>\n",
|
1053 |
+
" <th>collateral_amount</th>\n",
|
1054 |
+
" <th>outcome_index</th>\n",
|
1055 |
+
" <th>trade_fee_amount</th>\n",
|
1056 |
+
" <th>outcomes_tokens_traded</th>\n",
|
1057 |
+
" <th>...</th>\n",
|
1058 |
+
" <th>is_invalid</th>\n",
|
1059 |
+
" <th>winning_trade</th>\n",
|
1060 |
+
" <th>earnings</th>\n",
|
1061 |
+
" <th>redeemed</th>\n",
|
1062 |
+
" <th>redeemed_amount</th>\n",
|
1063 |
+
" <th>num_mech_calls</th>\n",
|
1064 |
+
" <th>mech_fee_amount</th>\n",
|
1065 |
+
" <th>net_earnings</th>\n",
|
1066 |
+
" <th>roi</th>\n",
|
1067 |
+
" <th>staking</th>\n",
|
1068 |
+
" </tr>\n",
|
1069 |
+
" </thead>\n",
|
1070 |
+
" <tbody>\n",
|
1071 |
+
" <tr>\n",
|
1072 |
+
" <th>0</th>\n",
|
1073 |
+
" <td>0x027592700fafc4db3221bb662d7bdc7f546a2bb5</td>\n",
|
1074 |
+
" <td>quickstart</td>\n",
|
1075 |
+
" <td>0x08ee7c048ea0b7e3c967a455cf7da5e38abdbaff0x02...</td>\n",
|
1076 |
+
" <td>2024-11-28 16:56:25+00:00</td>\n",
|
1077 |
+
" <td>Will any major legal precedent regarding influ...</td>\n",
|
1078 |
+
" <td>OPEN</td>\n",
|
1079 |
+
" <td>0.318926</td>\n",
|
1080 |
+
" <td>1</td>\n",
|
1081 |
+
" <td>0.003189</td>\n",
|
1082 |
+
" <td>0.642313</td>\n",
|
1083 |
+
" <td>...</td>\n",
|
1084 |
+
" <td>False</td>\n",
|
1085 |
+
" <td>None</td>\n",
|
1086 |
+
" <td>0.0</td>\n",
|
1087 |
+
" <td>False</td>\n",
|
1088 |
+
" <td>0</td>\n",
|
1089 |
+
" <td>0</td>\n",
|
1090 |
+
" <td>0.0</td>\n",
|
1091 |
+
" <td>-0.322116</td>\n",
|
1092 |
+
" <td>-1.0</td>\n",
|
1093 |
+
" <td>non_agent</td>\n",
|
1094 |
+
" </tr>\n",
|
1095 |
+
" <tr>\n",
|
1096 |
+
" <th>1</th>\n",
|
1097 |
+
" <td>0x027592700fafc4db3221bb662d7bdc7f546a2bb5</td>\n",
|
1098 |
+
" <td>quickstart</td>\n",
|
1099 |
+
" <td>0x08ee7c048ea0b7e3c967a455cf7da5e38abdbaff0x02...</td>\n",
|
1100 |
+
" <td>2024-11-30 15:00:10+00:00</td>\n",
|
1101 |
+
" <td>Will any major legal precedent regarding influ...</td>\n",
|
1102 |
+
" <td>OPEN</td>\n",
|
1103 |
+
" <td>0.106057</td>\n",
|
1104 |
+
" <td>0</td>\n",
|
1105 |
+
" <td>0.001061</td>\n",
|
1106 |
+
" <td>0.244680</td>\n",
|
1107 |
+
" <td>...</td>\n",
|
1108 |
+
" <td>False</td>\n",
|
1109 |
+
" <td>None</td>\n",
|
1110 |
+
" <td>0.0</td>\n",
|
1111 |
+
" <td>False</td>\n",
|
1112 |
+
" <td>0</td>\n",
|
1113 |
+
" <td>0</td>\n",
|
1114 |
+
" <td>0.0</td>\n",
|
1115 |
+
" <td>-0.107117</td>\n",
|
1116 |
+
" <td>-1.0</td>\n",
|
1117 |
+
" <td>non_agent</td>\n",
|
1118 |
+
" </tr>\n",
|
1119 |
+
" <tr>\n",
|
1120 |
+
" <th>2</th>\n",
|
1121 |
+
" <td>0x027592700fafc4db3221bb662d7bdc7f546a2bb5</td>\n",
|
1122 |
+
" <td>quickstart</td>\n",
|
1123 |
+
" <td>0x1bdd848ae9044375c11b6ab5eddd2e4f9ff0f0aa0x02...</td>\n",
|
1124 |
+
" <td>2024-12-01 23:09:55+00:00</td>\n",
|
1125 |
+
" <td>Will any Democratic senator publicly call for ...</td>\n",
|
1126 |
+
" <td>OPEN</td>\n",
|
1127 |
+
" <td>0.152501</td>\n",
|
1128 |
+
" <td>0</td>\n",
|
1129 |
+
" <td>0.001525</td>\n",
|
1130 |
+
" <td>0.304904</td>\n",
|
1131 |
+
" <td>...</td>\n",
|
1132 |
+
" <td>False</td>\n",
|
1133 |
+
" <td>None</td>\n",
|
1134 |
+
" <td>0.0</td>\n",
|
1135 |
+
" <td>False</td>\n",
|
1136 |
+
" <td>0</td>\n",
|
1137 |
+
" <td>0</td>\n",
|
1138 |
+
" <td>0.0</td>\n",
|
1139 |
+
" <td>-0.154026</td>\n",
|
1140 |
+
" <td>-1.0</td>\n",
|
1141 |
+
" <td>non_agent</td>\n",
|
1142 |
+
" </tr>\n",
|
1143 |
+
" <tr>\n",
|
1144 |
+
" <th>3</th>\n",
|
1145 |
+
" <td>0x027592700fafc4db3221bb662d7bdc7f546a2bb5</td>\n",
|
1146 |
+
" <td>quickstart</td>\n",
|
1147 |
+
" <td>0x25408c25b8681e994e2e12c6754ddf446124cce90x02...</td>\n",
|
1148 |
+
" <td>2024-11-30 13:54:45+00:00</td>\n",
|
1149 |
+
" <td>Will any major Linux distribution announce a s...</td>\n",
|
1150 |
+
" <td>OPEN</td>\n",
|
1151 |
+
" <td>0.245306</td>\n",
|
1152 |
+
" <td>0</td>\n",
|
1153 |
+
" <td>0.002453</td>\n",
|
1154 |
+
" <td>0.507058</td>\n",
|
1155 |
+
" <td>...</td>\n",
|
1156 |
+
" <td>False</td>\n",
|
1157 |
+
" <td>None</td>\n",
|
1158 |
+
" <td>0.0</td>\n",
|
1159 |
+
" <td>False</td>\n",
|
1160 |
+
" <td>0</td>\n",
|
1161 |
+
" <td>0</td>\n",
|
1162 |
+
" <td>0.0</td>\n",
|
1163 |
+
" <td>-0.247759</td>\n",
|
1164 |
+
" <td>-1.0</td>\n",
|
1165 |
+
" <td>non_agent</td>\n",
|
1166 |
+
" </tr>\n",
|
1167 |
+
" <tr>\n",
|
1168 |
+
" <th>4</th>\n",
|
1169 |
+
" <td>0x027592700fafc4db3221bb662d7bdc7f546a2bb5</td>\n",
|
1170 |
+
" <td>quickstart</td>\n",
|
1171 |
+
" <td>0x2b5f1a0eef4c846bfddc4ae88bd1a6d02a9e703d0x02...</td>\n",
|
1172 |
+
" <td>2024-11-30 13:39:40+00:00</td>\n",
|
1173 |
+
" <td>Will any cybersecurity firm release a detailed...</td>\n",
|
1174 |
+
" <td>OPEN</td>\n",
|
1175 |
+
" <td>0.277566</td>\n",
|
1176 |
+
" <td>0</td>\n",
|
1177 |
+
" <td>0.002776</td>\n",
|
1178 |
+
" <td>0.520043</td>\n",
|
1179 |
+
" <td>...</td>\n",
|
1180 |
+
" <td>False</td>\n",
|
1181 |
+
" <td>None</td>\n",
|
1182 |
+
" <td>0.0</td>\n",
|
1183 |
+
" <td>False</td>\n",
|
1184 |
+
" <td>0</td>\n",
|
1185 |
+
" <td>0</td>\n",
|
1186 |
+
" <td>0.0</td>\n",
|
1187 |
+
" <td>-0.280342</td>\n",
|
1188 |
+
" <td>-1.0</td>\n",
|
1189 |
+
" <td>non_agent</td>\n",
|
1190 |
+
" </tr>\n",
|
1191 |
+
" </tbody>\n",
|
1192 |
+
"</table>\n",
|
1193 |
+
"<p>5 rows × 21 columns</p>\n",
|
1194 |
+
"</div>"
|
1195 |
+
],
|
1196 |
+
"text/plain": [
|
1197 |
+
" trader_address market_creator \\\n",
|
1198 |
+
"0 0x027592700fafc4db3221bb662d7bdc7f546a2bb5 quickstart \n",
|
1199 |
+
"1 0x027592700fafc4db3221bb662d7bdc7f546a2bb5 quickstart \n",
|
1200 |
+
"2 0x027592700fafc4db3221bb662d7bdc7f546a2bb5 quickstart \n",
|
1201 |
+
"3 0x027592700fafc4db3221bb662d7bdc7f546a2bb5 quickstart \n",
|
1202 |
+
"4 0x027592700fafc4db3221bb662d7bdc7f546a2bb5 quickstart \n",
|
1203 |
+
"\n",
|
1204 |
+
" trade_id \\\n",
|
1205 |
+
"0 0x08ee7c048ea0b7e3c967a455cf7da5e38abdbaff0x02... \n",
|
1206 |
+
"1 0x08ee7c048ea0b7e3c967a455cf7da5e38abdbaff0x02... \n",
|
1207 |
+
"2 0x1bdd848ae9044375c11b6ab5eddd2e4f9ff0f0aa0x02... \n",
|
1208 |
+
"3 0x25408c25b8681e994e2e12c6754ddf446124cce90x02... \n",
|
1209 |
+
"4 0x2b5f1a0eef4c846bfddc4ae88bd1a6d02a9e703d0x02... \n",
|
1210 |
+
"\n",
|
1211 |
+
" creation_timestamp \\\n",
|
1212 |
+
"0 2024-11-28 16:56:25+00:00 \n",
|
1213 |
+
"1 2024-11-30 15:00:10+00:00 \n",
|
1214 |
+
"2 2024-12-01 23:09:55+00:00 \n",
|
1215 |
+
"3 2024-11-30 13:54:45+00:00 \n",
|
1216 |
+
"4 2024-11-30 13:39:40+00:00 \n",
|
1217 |
+
"\n",
|
1218 |
+
" title market_status \\\n",
|
1219 |
+
"0 Will any major legal precedent regarding influ... OPEN \n",
|
1220 |
+
"1 Will any major legal precedent regarding influ... OPEN \n",
|
1221 |
+
"2 Will any Democratic senator publicly call for ... OPEN \n",
|
1222 |
+
"3 Will any major Linux distribution announce a s... OPEN \n",
|
1223 |
+
"4 Will any cybersecurity firm release a detailed... OPEN \n",
|
1224 |
+
"\n",
|
1225 |
+
" collateral_amount outcome_index trade_fee_amount outcomes_tokens_traded \\\n",
|
1226 |
+
"0 0.318926 1 0.003189 0.642313 \n",
|
1227 |
+
"1 0.106057 0 0.001061 0.244680 \n",
|
1228 |
+
"2 0.152501 0 0.001525 0.304904 \n",
|
1229 |
+
"3 0.245306 0 0.002453 0.507058 \n",
|
1230 |
+
"4 0.277566 0 0.002776 0.520043 \n",
|
1231 |
+
"\n",
|
1232 |
+
" ... is_invalid winning_trade earnings redeemed redeemed_amount \\\n",
|
1233 |
+
"0 ... False None 0.0 False 0 \n",
|
1234 |
+
"1 ... False None 0.0 False 0 \n",
|
1235 |
+
"2 ... False None 0.0 False 0 \n",
|
1236 |
+
"3 ... False None 0.0 False 0 \n",
|
1237 |
+
"4 ... False None 0.0 False 0 \n",
|
1238 |
+
"\n",
|
1239 |
+
" num_mech_calls mech_fee_amount net_earnings roi staking \n",
|
1240 |
+
"0 0 0.0 -0.322116 -1.0 non_agent \n",
|
1241 |
+
"1 0 0.0 -0.107117 -1.0 non_agent \n",
|
1242 |
+
"2 0 0.0 -0.154026 -1.0 non_agent \n",
|
1243 |
+
"3 0 0.0 -0.247759 -1.0 non_agent \n",
|
1244 |
+
"4 0 0.0 -0.280342 -1.0 non_agent \n",
|
1245 |
+
"\n",
|
1246 |
+
"[5 rows x 21 columns]"
|
1247 |
+
]
|
1248 |
+
},
|
1249 |
+
"execution_count": 31,
|
1250 |
+
"metadata": {},
|
1251 |
+
"output_type": "execute_result"
|
1252 |
+
}
|
1253 |
+
],
|
1254 |
+
"source": [
|
1255 |
+
"all_trades_before.head()"
|
1256 |
+
]
|
1257 |
+
},
|
1258 |
+
{
|
1259 |
+
"cell_type": "code",
|
1260 |
+
"execution_count": null,
|
1261 |
+
"metadata": {},
|
1262 |
+
"outputs": [],
|
1263 |
+
"source": []
|
1264 |
+
},
|
1265 |
{
|
1266 |
"cell_type": "code",
|
1267 |
"execution_count": 7,
|
scripts/metrics.py
CHANGED
@@ -29,7 +29,7 @@ def compute_metrics(
|
|
29 |
total_nr_mech_calls_all_markets = compute_total_nr_mech_calls_per_trader(
|
30 |
trader_data
|
31 |
)
|
32 |
-
|
33 |
agg_metrics["bet_amount"] = total_bet_amounts
|
34 |
agg_metrics["nr_mech_calls"] = total_nr_mech_calls_all_markets
|
35 |
agg_metrics["staking"] = trader_data.iloc[0].staking
|
@@ -39,6 +39,9 @@ def compute_metrics(
|
|
39 |
total_earnings = trader_data.earnings.sum()
|
40 |
agg_metrics["earnings"] = total_earnings
|
41 |
total_fee_amounts = trader_data.mech_fee_amount.sum()
|
|
|
|
|
|
|
42 |
total_costs = (
|
43 |
total_bet_amounts
|
44 |
+ total_fee_amounts
|
@@ -46,12 +49,12 @@ def compute_metrics(
|
|
46 |
)
|
47 |
total_net_earnings = total_earnings - total_costs
|
48 |
previous_net_earnings = trader_data.net_earnings.sum()
|
49 |
-
# if previous_net_earnings > total_net_earnings:
|
50 |
-
# print(
|
51 |
-
# f"case for trader {trader_address} where previous net_earnings was higher {previous_net_earnings} > {total_net_earnings} "
|
52 |
-
# )
|
53 |
agg_metrics["net_earnings"] = total_net_earnings
|
54 |
agg_metrics["roi"] = total_net_earnings / total_costs
|
|
|
|
|
|
|
|
|
55 |
return agg_metrics
|
56 |
|
57 |
|
|
|
29 |
total_nr_mech_calls_all_markets = compute_total_nr_mech_calls_per_trader(
|
30 |
trader_data
|
31 |
)
|
32 |
+
previous_total = trader_data.num_mech_calls.sum()
|
33 |
agg_metrics["bet_amount"] = total_bet_amounts
|
34 |
agg_metrics["nr_mech_calls"] = total_nr_mech_calls_all_markets
|
35 |
agg_metrics["staking"] = trader_data.iloc[0].staking
|
|
|
39 |
total_earnings = trader_data.earnings.sum()
|
40 |
agg_metrics["earnings"] = total_earnings
|
41 |
total_fee_amounts = trader_data.mech_fee_amount.sum()
|
42 |
+
previous_costs = (
|
43 |
+
total_bet_amounts + total_fee_amounts + previous_total * DEFAULT_MECH_FEE
|
44 |
+
)
|
45 |
total_costs = (
|
46 |
total_bet_amounts
|
47 |
+ total_fee_amounts
|
|
|
49 |
)
|
50 |
total_net_earnings = total_earnings - total_costs
|
51 |
previous_net_earnings = trader_data.net_earnings.sum()
|
|
|
|
|
|
|
|
|
52 |
agg_metrics["net_earnings"] = total_net_earnings
|
53 |
agg_metrics["roi"] = total_net_earnings / total_costs
|
54 |
+
agg_metrics["previous_roi"] = previous_net_earnings / previous_costs
|
55 |
+
agg_metrics["roi_diff_perc"] = 100.0 * (
|
56 |
+
(agg_metrics["roi"] - agg_metrics["previous_roi"]) / abs(agg_metrics["roi"])
|
57 |
+
)
|
58 |
return agg_metrics
|
59 |
|
60 |
|