rosacastillo
commited on
Commit
·
48ce3b8
1
Parent(s):
06ca88f
Adding new staking tab for trades
Browse files- app.py +21 -1
- data/all_trades_profitability.parquet +2 -2
- data/outliers.parquet +2 -2
- data/service_map.pkl +3 -0
- notebooks/roi_analysis.ipynb +27 -26
- notebooks/staking.ipynb +812 -0
- scripts/profitability.py +4 -0
- scripts/staking.py +213 -0
- tabs/staking.py +83 -0
app.py
CHANGED
@@ -12,6 +12,7 @@ from tabs.trades import (
|
|
12 |
integrated_plot_trades_per_market_by_week,
|
13 |
integrated_plot_winning_trades_per_market_by_week,
|
14 |
)
|
|
|
15 |
|
16 |
from tabs.metrics import (
|
17 |
trade_metric_choices,
|
@@ -173,6 +174,7 @@ tools_df, trades_df, tools_accuracy_info, invalid_trades = prepare_data()
|
|
173 |
|
174 |
|
175 |
demo = gr.Blocks()
|
|
|
176 |
# preparing data for the errors
|
177 |
error_by_markets = get_error_data_by_market(tools_df=tools_df, inc_tools=INC_TOOLS)
|
178 |
error_overall_by_markets = get_error_data_overall_by_market(error_df=error_by_markets)
|
@@ -242,7 +244,25 @@ with demo:
|
|
242 |
trade_details_plot
|
243 |
with gr.Column(scale=1):
|
244 |
trade_details_text
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
with gr.TabItem("🚀 Tool Winning Dashboard"):
|
247 |
with gr.Row():
|
248 |
gr.Markdown("# All tools winning performance")
|
|
|
12 |
integrated_plot_trades_per_market_by_week,
|
13 |
integrated_plot_winning_trades_per_market_by_week,
|
14 |
)
|
15 |
+
from tabs.staking import plot_staking_trades_per_market_by_week
|
16 |
|
17 |
from tabs.metrics import (
|
18 |
trade_metric_choices,
|
|
|
174 |
|
175 |
|
176 |
demo = gr.Blocks()
|
177 |
+
|
178 |
# preparing data for the errors
|
179 |
error_by_markets = get_error_data_by_market(tools_df=tools_df, inc_tools=INC_TOOLS)
|
180 |
error_overall_by_markets = get_error_data_overall_by_market(error_df=error_by_markets)
|
|
|
244 |
trade_details_plot
|
245 |
with gr.Column(scale=1):
|
246 |
trade_details_text
|
247 |
+
with gr.TabItem("🔒 Staking traders"):
|
248 |
+
with gr.Row():
|
249 |
+
gr.Markdown("# Trades done at the pearl markets")
|
250 |
+
with gr.Row():
|
251 |
+
staking_trades_by_week = plot_staking_trades_per_market_by_week(
|
252 |
+
trades_df=trades_df, market_creator="pearl"
|
253 |
+
)
|
254 |
+
with gr.Row():
|
255 |
+
gr.Markdown("# Trades done at the quickstart markets")
|
256 |
+
with gr.Row():
|
257 |
+
staking_trades_by_week = plot_staking_trades_per_market_by_week(
|
258 |
+
trades_df=trades_df, market_creator="quickstart"
|
259 |
+
)
|
260 |
+
with gr.Row():
|
261 |
+
gr.Markdown("# Trades done at the all markets")
|
262 |
+
with gr.Row():
|
263 |
+
staking_trades_by_week = plot_staking_trades_per_market_by_week(
|
264 |
+
trades_df=trades_df, market_creator="all"
|
265 |
+
)
|
266 |
with gr.TabItem("🚀 Tool Winning Dashboard"):
|
267 |
with gr.Row():
|
268 |
gr.Markdown("# All tools winning performance")
|
data/all_trades_profitability.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fa8f1d9bc8b3f1f017dfc7df01367beafa4de12af9d40030317784d06f9e3dde
|
3 |
+
size 411164
|
data/outliers.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7da1c4dba61686a580c61a870ba9a38c83ff5b25201cfe1f7ddf5a214438c322
|
3 |
+
size 17851
|
data/service_map.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6d0859b181fccfb5cf28a19af36f099f3f828d8fcc72c95a5a6a3bff94044d87
|
3 |
+
size 72340
|
notebooks/roi_analysis.ipynb
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
"metadata": {},
|
20 |
"outputs": [],
|
21 |
"source": [
|
22 |
-
"tools = pd.read_parquet('../data/tools.parquet')\n",
|
23 |
"fpmms = pd.read_parquet('../data/fpmms.parquet')\n",
|
24 |
"summary_traders = pd.read_parquet('../data/summary_profitability.parquet')\n",
|
25 |
"all_trades = pd.read_parquet('../data/all_trades_profitability.parquet')"
|
@@ -51,7 +51,7 @@
|
|
51 |
},
|
52 |
{
|
53 |
"cell_type": "code",
|
54 |
-
"execution_count":
|
55 |
"metadata": {},
|
56 |
"outputs": [
|
57 |
{
|
@@ -59,31 +59,32 @@
|
|
59 |
"output_type": "stream",
|
60 |
"text": [
|
61 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
62 |
-
"RangeIndex:
|
63 |
-
"Data columns (total
|
64 |
" # Column Non-Null Count Dtype \n",
|
65 |
"--- ------ -------------- ----- \n",
|
66 |
-
" 0 trader_address
|
67 |
-
" 1
|
68 |
-
" 2
|
69 |
-
" 3
|
70 |
-
" 4
|
71 |
-
" 5
|
72 |
-
" 6
|
73 |
-
" 7
|
74 |
-
" 8
|
75 |
-
" 9
|
76 |
-
" 10
|
77 |
-
" 11
|
78 |
-
" 12
|
79 |
-
" 13
|
80 |
-
" 14
|
81 |
-
" 15
|
82 |
-
" 16
|
83 |
-
" 17
|
84 |
-
" 18
|
85 |
-
"
|
86 |
-
"
|
|
|
87 |
]
|
88 |
}
|
89 |
],
|
@@ -722,7 +723,7 @@
|
|
722 |
"name": "python",
|
723 |
"nbconvert_exporter": "python",
|
724 |
"pygments_lexer": "ipython3",
|
725 |
-
"version": "3.12.
|
726 |
}
|
727 |
},
|
728 |
"nbformat": 4,
|
|
|
19 |
"metadata": {},
|
20 |
"outputs": [],
|
21 |
"source": [
|
22 |
+
"#tools = pd.read_parquet('../data/tools.parquet')\n",
|
23 |
"fpmms = pd.read_parquet('../data/fpmms.parquet')\n",
|
24 |
"summary_traders = pd.read_parquet('../data/summary_profitability.parquet')\n",
|
25 |
"all_trades = pd.read_parquet('../data/all_trades_profitability.parquet')"
|
|
|
51 |
},
|
52 |
{
|
53 |
"cell_type": "code",
|
54 |
+
"execution_count": 3,
|
55 |
"metadata": {},
|
56 |
"outputs": [
|
57 |
{
|
|
|
59 |
"output_type": "stream",
|
60 |
"text": [
|
61 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
62 |
+
"RangeIndex: 4872 entries, 0 to 4871\n",
|
63 |
+
"Data columns (total 20 columns):\n",
|
64 |
" # Column Non-Null Count Dtype \n",
|
65 |
"--- ------ -------------- ----- \n",
|
66 |
+
" 0 trader_address 4872 non-null object \n",
|
67 |
+
" 1 market_creator 4872 non-null object \n",
|
68 |
+
" 2 trade_id 4872 non-null object \n",
|
69 |
+
" 3 creation_timestamp 4872 non-null datetime64[ns, UTC]\n",
|
70 |
+
" 4 title 4872 non-null object \n",
|
71 |
+
" 5 market_status 4872 non-null object \n",
|
72 |
+
" 6 collateral_amount 4872 non-null float64 \n",
|
73 |
+
" 7 outcome_index 4872 non-null object \n",
|
74 |
+
" 8 trade_fee_amount 4872 non-null float64 \n",
|
75 |
+
" 9 outcomes_tokens_traded 4872 non-null float64 \n",
|
76 |
+
" 10 current_answer 4872 non-null int64 \n",
|
77 |
+
" 11 is_invalid 4872 non-null bool \n",
|
78 |
+
" 12 winning_trade 4872 non-null bool \n",
|
79 |
+
" 13 earnings 4872 non-null float64 \n",
|
80 |
+
" 14 redeemed 4872 non-null bool \n",
|
81 |
+
" 15 redeemed_amount 4872 non-null float64 \n",
|
82 |
+
" 16 num_mech_calls 4872 non-null int64 \n",
|
83 |
+
" 17 mech_fee_amount 4872 non-null float64 \n",
|
84 |
+
" 18 net_earnings 4872 non-null float64 \n",
|
85 |
+
" 19 roi 4872 non-null float64 \n",
|
86 |
+
"dtypes: bool(3), datetime64[ns, UTC](1), float64(8), int64(2), object(6)\n",
|
87 |
+
"memory usage: 661.5+ KB\n"
|
88 |
]
|
89 |
}
|
90 |
],
|
|
|
723 |
"name": "python",
|
724 |
"nbconvert_exporter": "python",
|
725 |
"pygments_lexer": "ipython3",
|
726 |
+
"version": "3.12.2"
|
727 |
}
|
728 |
},
|
729 |
"nbformat": 4,
|
notebooks/staking.ipynb
ADDED
@@ -0,0 +1,812 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 9,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import json\n",
|
10 |
+
"import sys\n",
|
11 |
+
"from pathlib import Path\n",
|
12 |
+
"from typing import Any, List\n",
|
13 |
+
"import requests\n",
|
14 |
+
"from tqdm import tqdm\n",
|
15 |
+
"from web3 import Web3\n",
|
16 |
+
"import pandas as pd\n",
|
17 |
+
"import pickle\n",
|
18 |
+
"from concurrent.futures import ThreadPoolExecutor, as_completed\n",
|
19 |
+
"\n",
|
20 |
+
"NUM_WORKERS = 10\n",
|
21 |
+
"DEPRECATED_STAKING_PROGRAMS = {\n",
|
22 |
+
" \"quickstart_alpha_everest\": \"0x5add592ce0a1B5DceCebB5Dcac086Cd9F9e3eA5C\",\n",
|
23 |
+
" \"quickstart_alpha_alpine\": \"0x2Ef503950Be67a98746F484DA0bBAdA339DF3326\",\n",
|
24 |
+
" \"quickstart_alpha_coastal\": \"0x43fB32f25dce34EB76c78C7A42C8F40F84BCD237\",\n",
|
25 |
+
"}\n",
|
26 |
+
"STAKING_PROGRAMS_QS = {\n",
|
27 |
+
" \"quickstart_beta_hobbyist\": \"0x389B46c259631Acd6a69Bde8B6cEe218230bAE8C\",\n",
|
28 |
+
" \"quickstart_beta_hobbyist_2\": \"0x238EB6993b90a978ec6AAD7530d6429c949C08DA\",\n",
|
29 |
+
" \"quickstart_beta_expert\": \"0x5344B7DD311e5d3DdDd46A4f71481bD7b05AAA3e\",\n",
|
30 |
+
" \"quickstart_beta_expert_2\": \"0xb964e44c126410df341ae04B13aB10A985fE3513\",\n",
|
31 |
+
" \"quickstart_beta_expert_3\": \"0x80faD33Cadb5F53f9D29F02Db97D682E8b101618\",\n",
|
32 |
+
"}\n",
|
33 |
+
"\n",
|
34 |
+
"STAKING_PROGRAMS_PEARL = {\n",
|
35 |
+
" \"pearl_alpha\": \"0xEE9F19b5DF06c7E8Bfc7B28745dcf944C504198A\",\n",
|
36 |
+
" \"pearl_beta\": \"0xeF44Fb0842DDeF59D37f85D61A1eF492bbA6135d\",\n",
|
37 |
+
" \"pearl_beta_2\": \"0x1c2F82413666d2a3fD8bC337b0268e62dDF67434\",\n",
|
38 |
+
"}\n",
|
39 |
+
"SERVICE_REGISTRY_ADDRESS = \"0x9338b5153AE39BB89f50468E608eD9d764B755fD\"\n",
|
40 |
+
"\n",
|
41 |
+
"\n",
|
42 |
+
"\n",
|
43 |
+
"\n",
|
44 |
+
"def check_owner_staking_contract(owner_address: str) -> str:\n",
|
45 |
+
" staking = \"\"\n",
|
46 |
+
" owner_address = owner_address.lower()\n",
|
47 |
+
" # check quickstart staking contracts\n",
|
48 |
+
" qs_list = [x.lower() for x in STAKING_PROGRAMS_QS.values()]\n",
|
49 |
+
" if owner_address in qs_list:\n",
|
50 |
+
" return \"quickstart\"\n",
|
51 |
+
"\n",
|
52 |
+
" # check pearl staking contracts\n",
|
53 |
+
" pearl_list = [x.lower() for x in STAKING_PROGRAMS_PEARL.values()]\n",
|
54 |
+
" if owner_address in pearl_list:\n",
|
55 |
+
" return \"pearl\"\n",
|
56 |
+
"\n",
|
57 |
+
" # check legacy staking contracts\n",
|
58 |
+
" deprec_list = [x.lower() for x in DEPRECATED_STAKING_PROGRAMS.values()]\n",
|
59 |
+
" if owner_address in deprec_list:\n",
|
60 |
+
" return \"quickstart\"\n",
|
61 |
+
"\n",
|
62 |
+
" return staking\n",
|
63 |
+
"\n",
|
64 |
+
"\n",
|
65 |
+
"def get_trader_address_staking(trader_address: str) -> str:\n",
|
66 |
+
" # check if there is any service id linked with that trader address\n",
|
67 |
+
" with open(\"../data/service_map.pkl\", \"rb\") as f:\n",
|
68 |
+
" service_map = pickle.load(f)\n",
|
69 |
+
" found_key = -1\n",
|
70 |
+
" for key, value in service_map.items():\n",
|
71 |
+
" if value[\"safe_address\"].lower() == trader_address.lower():\n",
|
72 |
+
" # found a service\n",
|
73 |
+
" found_key = key\n",
|
74 |
+
" break\n",
|
75 |
+
"\n",
|
76 |
+
" if found_key == -1:\n",
|
77 |
+
" print(\"trader address not found in the service map\")\n",
|
78 |
+
" return \"\"\n",
|
79 |
+
" owner = service_map[found_key][\"owner_address\"]\n",
|
80 |
+
" return check_owner_staking_contract(owner_address=owner)\n",
|
81 |
+
"\n",
|
82 |
+
"\n",
|
83 |
+
"def label_trades_by_staking(trades_df: pd.DataFrame) -> pd.DataFrame:\n",
|
84 |
+
" all_traders = trades_df.trader_address.unique()\n",
|
85 |
+
" trades_df[\"staking\"] = \"\"\n",
|
86 |
+
" for trader in tqdm(all_traders, desc=\"Labeling traders by staking\", unit=\"trader\"):\n",
|
87 |
+
" tqdm.write(f\"checking trader {trader}\")\n",
|
88 |
+
" staking_label = get_trader_address_staking(trader)\n",
|
89 |
+
" if staking_label != \"\":\n",
|
90 |
+
" trades_df.loc[trades_df[\"trader_address\"] == trader, \"staking\"] = staking_label\n",
|
91 |
+
" tqdm.write(f\"statking label {staking_label}\")\n",
|
92 |
+
" return trades_df"
|
93 |
+
]
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"cell_type": "code",
|
97 |
+
"execution_count": 10,
|
98 |
+
"metadata": {},
|
99 |
+
"outputs": [
|
100 |
+
{
|
101 |
+
"name": "stderr",
|
102 |
+
"output_type": "stream",
|
103 |
+
"text": [
|
104 |
+
"Labeling traders by staking: 51%|█████ | 104/204 [00:00<00:00, 522.80trader/s]"
|
105 |
+
]
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"name": "stdout",
|
109 |
+
"output_type": "stream",
|
110 |
+
"text": [
|
111 |
+
"checking trader 0x022b36c50b85b8ae7addfb8a35d76c59d5814834\n",
|
112 |
+
"statking label \n",
|
113 |
+
"checking trader 0x034c4ad84f7ac6638bf19300d5bbe7d9b981e736\n",
|
114 |
+
"trader address not found in the service map\n",
|
115 |
+
"statking label \n",
|
116 |
+
"checking trader 0x09e9d42a029e8b0c2df3871709a762117a681d92\n",
|
117 |
+
"statking label \n",
|
118 |
+
"checking trader 0x0d049dcaece0ecb6fc81a460da7bcc2a4785d6e5\n",
|
119 |
+
"statking label \n",
|
120 |
+
"checking trader 0x1c1bb5398ba525c5bca07eeade45958e455de4b3\n",
|
121 |
+
"statking label quickstart\n",
|
122 |
+
"checking trader 0x246f6787c409dd5139b7029cd63b7d6aad08cc61\n",
|
123 |
+
"statking label \n",
|
124 |
+
"checking trader 0x2dd9f5678484c1f59f97ed334725858b938b4102\n",
|
125 |
+
"trader address not found in the service map\n",
|
126 |
+
"statking label \n",
|
127 |
+
"checking trader 0x3666da333dadd05083fef9ff6ddee588d26e4307\n",
|
128 |
+
"trader address not found in the service map\n",
|
129 |
+
"statking label \n",
|
130 |
+
"checking trader 0x3a461ae963acf0fedc72a07d060b8e1f44851b28\n",
|
131 |
+
"statking label \n",
|
132 |
+
"checking trader 0x49f4e3d8edc85efda9b0a36d96e406a59b13fcc2\n",
|
133 |
+
"statking label quickstart\n",
|
134 |
+
"checking trader 0x4e8b85a2b2ffa1f586441d1410f09b416d450d91\n",
|
135 |
+
"statking label \n",
|
136 |
+
"checking trader 0x559480d7892f1934ca93ab9cb9100c048057fb32\n",
|
137 |
+
"trader address not found in the service map\n",
|
138 |
+
"statking label \n",
|
139 |
+
"checking trader 0x5adc20d9d3c55ca147a280ac3f911707c6a138d0\n",
|
140 |
+
"statking label \n",
|
141 |
+
"checking trader 0x625cf416a9f525d9480cafb9b9ac83401a2b2b33\n",
|
142 |
+
"statking label \n",
|
143 |
+
"checking trader 0x6990f82b90a151aa63fca5d3afd8e9e275dba4cf\n",
|
144 |
+
"statking label \n",
|
145 |
+
"checking trader 0x70fdcdcef0d636db08a581dc510755cc53facdc2\n",
|
146 |
+
"statking label \n",
|
147 |
+
"checking trader 0x74d2b585a46279b4fa9feeae001efc972726c709\n",
|
148 |
+
"statking label \n",
|
149 |
+
"checking trader 0x77ca61cb789799bd8918036edb3ca8e6c4ca76f1\n",
|
150 |
+
"trader address not found in the service map\n",
|
151 |
+
"statking label \n",
|
152 |
+
"checking trader 0x95ecc70d9f4feb162ed9f41c4432d990c36c8f57\n",
|
153 |
+
"statking label quickstart\n",
|
154 |
+
"checking trader 0x966802275f0208ac34f3e74c67d62c46e69fe378\n",
|
155 |
+
"statking label quickstart\n",
|
156 |
+
"checking trader 0x9694c0fdb79a37d048ea19deb15e051482a690c4\n",
|
157 |
+
"statking label \n",
|
158 |
+
"checking trader 0x98973c9c66a79b6cc7ed655d830d1ad84067c5e5\n",
|
159 |
+
"statking label quickstart\n",
|
160 |
+
"checking trader 0x9d8337b10c7b820e44ae3273dab47220ea41bfc9\n",
|
161 |
+
"statking label quickstart\n",
|
162 |
+
"checking trader 0xa7314a168445a32fe43da3759d5861630f3b5d91\n",
|
163 |
+
"statking label \n",
|
164 |
+
"checking trader 0xa8efa5bb5c6ad476c9e0377dbf66cc41cb6d5bdd\n",
|
165 |
+
"trader address not found in the service map\n",
|
166 |
+
"statking label \n",
|
167 |
+
"checking trader 0xb611a9f02b318339049264c7a66ac3401281cc3c\n",
|
168 |
+
"trader address not found in the service map\n",
|
169 |
+
"statking label \n",
|
170 |
+
"checking trader 0xc4985d8b12eeef642c955c43c86b568417658839\n",
|
171 |
+
"statking label \n",
|
172 |
+
"checking trader 0xe7715def604bccfb93f34ccaf3610ed6ee9c6741\n",
|
173 |
+
"statking label \n",
|
174 |
+
"checking trader 0xe7aa88a1d044e5c987ecce55ae8d2b562a41b72d\n",
|
175 |
+
"trader address not found in the service map\n",
|
176 |
+
"statking label \n",
|
177 |
+
"checking trader 0xe84605f215126abdafb0b5a47de2d513e80aba68\n",
|
178 |
+
"statking label \n",
|
179 |
+
"checking trader 0xec97bdf61fcb901033a3b8fcbcde77a372927b61\n",
|
180 |
+
"statking label quickstart\n",
|
181 |
+
"checking trader 0xf8a323e669edabca3952e3bf7f18ade953d7e9b9\n",
|
182 |
+
"statking label \n",
|
183 |
+
"checking trader 0xfd3b85c97f0feeaf3a8f90c5022ab3ad9cce0000\n",
|
184 |
+
"trader address not found in the service map\n",
|
185 |
+
"statking label \n",
|
186 |
+
"checking trader 0x0822e82311bd2d7e381bd2c64cacd13b4c3fbe8a\n",
|
187 |
+
"statking label \n",
|
188 |
+
"checking trader 0x197a0a79d62af21c50813899b79947c7621281ad\n",
|
189 |
+
"statking label \n",
|
190 |
+
"checking trader 0x1bde46e6a3128fff5f0b94911bf6c447ad909215\n",
|
191 |
+
"statking label \n",
|
192 |
+
"checking trader 0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe\n",
|
193 |
+
"statking label \n",
|
194 |
+
"checking trader 0x36c0dfb4ffae10005db68c5a755aca5d3d711627\n",
|
195 |
+
"statking label \n",
|
196 |
+
"checking trader 0x3784c7866a0d308d72719aa17e888b457d399ca7\n",
|
197 |
+
"statking label quickstart\n",
|
198 |
+
"checking trader 0x4ecc9626b80a623e7bb2545d5cc1082ace765d03\n",
|
199 |
+
"statking label \n",
|
200 |
+
"checking trader 0x593c4ca4c85f24145de87e2591b7ec5d2e01d5e9\n",
|
201 |
+
"statking label quickstart\n",
|
202 |
+
"checking trader 0x61f5c7fa710bae60ab917fad0043f8efb4f8c3be\n",
|
203 |
+
"statking label \n",
|
204 |
+
"checking trader 0x8cd3e072c8341cfe1a03dbe1d6c32b5177b06164\n",
|
205 |
+
"statking label quickstart\n",
|
206 |
+
"checking trader 0x8dd0f0f64e575a356545d9ed096122a1887e64bf\n",
|
207 |
+
"statking label quickstart\n",
|
208 |
+
"checking trader 0x902a59ffe708d36f4498c8c9df51802250c5111c\n",
|
209 |
+
"statking label \n",
|
210 |
+
"checking trader 0xa0748aa2cc9ac8e5c7a813171590b92140aee491\n",
|
211 |
+
"statking label \n",
|
212 |
+
"checking trader 0xaa6763ea75eb13de1da2f3367d452336747f6e29\n",
|
213 |
+
"statking label quickstart\n",
|
214 |
+
"checking trader 0xb2f2958c02819dbc163d526ea699ab49a34d6dfb\n",
|
215 |
+
"statking label quickstart\n",
|
216 |
+
"checking trader 0xdacbe9368b329af4244727acfe20514d64d129ac\n",
|
217 |
+
"statking label \n",
|
218 |
+
"checking trader 0xfe2c8e93ce30d1c961831d8e4d120a307aedbe72\n",
|
219 |
+
"statking label \n",
|
220 |
+
"checking trader 0x3c01b79bad670a37c8784bdf47b973b341064f10\n",
|
221 |
+
"statking label quickstart\n",
|
222 |
+
"checking trader 0xc598397ce2b8bdf93071c0446d1eedc2141f01d0\n",
|
223 |
+
"statking label quickstart\n",
|
224 |
+
"checking trader 0x05e8bbdb89c84a14d05194bbbae81caf2340db72\n",
|
225 |
+
"trader address not found in the service map\n",
|
226 |
+
"statking label \n",
|
227 |
+
"checking trader 0x06944ca496e269bdefc322e453102022ac1d24e7\n",
|
228 |
+
"statking label quickstart\n",
|
229 |
+
"checking trader 0x0917ca217a8c679845bc97dfade9fd33f323a2f9\n",
|
230 |
+
"statking label quickstart\n",
|
231 |
+
"checking trader 0x1b80f1f8fee6fa9d4081e28a6aea4745a41e80d6\n",
|
232 |
+
"statking label quickstart\n",
|
233 |
+
"checking trader 0x1d942103400c1f1657dcbffd5e08904787ea936b\n",
|
234 |
+
"statking label quickstart\n",
|
235 |
+
"checking trader 0x38d5f6c7a4d9c3f09a9210412da80a7fd2e7325b\n",
|
236 |
+
"statking label quickstart\n",
|
237 |
+
"checking trader 0x3e013a3ca156032005c239de6d84badd3f9b13a9\n",
|
238 |
+
"trader address not found in the service map\n",
|
239 |
+
"statking label \n",
|
240 |
+
"checking trader 0x50cd23744cc33df8ea0c53c8e97174b2b8ea03c1\n",
|
241 |
+
"statking label quickstart\n",
|
242 |
+
"checking trader 0x59fab0cc4dd160862a55e5cf8b37719f156111a4\n",
|
243 |
+
"statking label quickstart\n",
|
244 |
+
"checking trader 0x61766a46659b67bbda5484bba45e524ccc652ee4\n",
|
245 |
+
"statking label quickstart\n",
|
246 |
+
"checking trader 0x6f40dbf1f102d47248802a423c0cd117ac4a3781\n",
|
247 |
+
"statking label quickstart\n",
|
248 |
+
"checking trader 0x75c0366bd0cbc3db434fd117267e32f26c5ed857\n",
|
249 |
+
"statking label quickstart\n",
|
250 |
+
"checking trader 0x839eaee319420e6dc83383bbb41fce4f8b0bb9aa\n",
|
251 |
+
"statking label quickstart\n",
|
252 |
+
"checking trader 0x9257309f1b614e84a5e73016ad393c378b3094ec\n",
|
253 |
+
"statking label quickstart\n",
|
254 |
+
"checking trader 0x9373cb196a3542afa583a91db604aee92068552a\n",
|
255 |
+
"statking label quickstart\n",
|
256 |
+
"checking trader 0x96fc9f4eb6b7c228aa018b7fea9b43d77023aa5a\n",
|
257 |
+
"statking label quickstart\n",
|
258 |
+
"checking trader 0xa156f5e98383c3e2a70faef71cc420780809e130\n",
|
259 |
+
"statking label quickstart\n",
|
260 |
+
"checking trader 0xaa14414fe80e18223e3d585b222ec699a6ccccfd\n",
|
261 |
+
"statking label quickstart\n",
|
262 |
+
"checking trader 0xacb24b20805c6e475d2c17edb2a997c1ba47de79\n",
|
263 |
+
"statking label quickstart\n",
|
264 |
+
"checking trader 0xb2912a22ee91272861931b693c434d420610abfe\n",
|
265 |
+
"statking label quickstart\n",
|
266 |
+
"checking trader 0xc08300f16b755b017a50347aa72b054be5dbd34b\n",
|
267 |
+
"statking label \n",
|
268 |
+
"checking trader 0xe594853a6cca34dda096b0a21062d12febd8a2c0\n",
|
269 |
+
"statking label quickstart\n",
|
270 |
+
"checking trader 0xe94b68e26c091dbb55e6e953b15168b0e6acba1f\n",
|
271 |
+
"statking label \n",
|
272 |
+
"checking trader 0xf21c4230f137ffcee12e69786d854e62a7b4b0ae\n",
|
273 |
+
"trader address not found in the service map\n",
|
274 |
+
"statking label \n",
|
275 |
+
"checking trader 0xf5fecb12cd783920d0ea71def523848fbc3ef972\n",
|
276 |
+
"statking label quickstart\n",
|
277 |
+
"checking trader 0xf758c18402ddef2d231911c4c326aa46510788f0\n",
|
278 |
+
"trader address not found in the service map\n",
|
279 |
+
"statking label \n",
|
280 |
+
"checking trader 0x0364b1a30877ade164271213d641494bd0475645\n",
|
281 |
+
"statking label \n",
|
282 |
+
"checking trader 0x32f47d021ffc0b8b883a8aef184556f68e993aba\n",
|
283 |
+
"statking label \n",
|
284 |
+
"checking trader 0x3c529bdcaf1f7b449abce3136ca7f56dfbd68373\n",
|
285 |
+
"statking label \n",
|
286 |
+
"checking trader 0x480e5b5abd27cd754745871116e79caf90468dd4\n",
|
287 |
+
"statking label \n",
|
288 |
+
"checking trader 0x6716c1831d0f2477891f5579e5e3b05dee3f176b\n",
|
289 |
+
"trader address not found in the service map\n",
|
290 |
+
"statking label \n",
|
291 |
+
"checking trader 0x6cbd1a957cbf3a84187113f58c0c026c268c7294\n",
|
292 |
+
"statking label \n",
|
293 |
+
"checking trader 0x6f99ccc54f239a9c0e7fe501e99c16b89785b96b\n",
|
294 |
+
"statking label \n",
|
295 |
+
"checking trader 0xc918c15b87746e6351e5f0646ddcaaca11af8568\n",
|
296 |
+
"trader address not found in the service map\n",
|
297 |
+
"statking label \n",
|
298 |
+
"checking trader 0xe711f95807145121e027df264612098ddf202fd7\n",
|
299 |
+
"statking label \n",
|
300 |
+
"checking trader 0xf089874165be0377680683fd5187a058dea82683\n",
|
301 |
+
"statking label \n",
|
302 |
+
"checking trader 0x217e261e0558938a878265d61603db1787744314\n",
|
303 |
+
"statking label \n",
|
304 |
+
"checking trader 0x6d0cb5f3264b5e11d61260538f9acc4385cbd767\n",
|
305 |
+
"statking label \n",
|
306 |
+
"checking trader 0x75f58030c190bb4288f56100f0ee49b6eeb4a134\n",
|
307 |
+
"trader address not found in the service map\n",
|
308 |
+
"statking label \n",
|
309 |
+
"checking trader 0x7c3bebb1eab77e6119d61f7c064bfca2eff788ad\n",
|
310 |
+
"statking label \n",
|
311 |
+
"checking trader 0x2349580dd7bbf6e6f54269068b8ed9cd5ddb7ba4\n",
|
312 |
+
"statking label \n",
|
313 |
+
"checking trader 0x671ccc08559041185f594c8f305b8fc66c8c9dda\n",
|
314 |
+
"statking label \n",
|
315 |
+
"checking trader 0x433f6981f65e97a629eda89accde2d8a0b11b5a6\n",
|
316 |
+
"trader address not found in the service map\n",
|
317 |
+
"statking label \n",
|
318 |
+
"checking trader 0xacdc2eebddaff07bcdab82f82bcc07f731e784aa\n",
|
319 |
+
"trader address not found in the service map\n",
|
320 |
+
"statking label \n",
|
321 |
+
"checking trader 0xd243a01df42f64ddc9e2f921e22832d4c1de9dcd\n",
|
322 |
+
"statking label \n",
|
323 |
+
"checking trader 0xb2b30b71bf8166fa3a3b9744a48765d43eb93d53\n",
|
324 |
+
"statking label \n",
|
325 |
+
"checking trader 0xbb9ee65ce6646a6b1d6a2511b72343a7e3d355af\n",
|
326 |
+
"statking label \n",
|
327 |
+
"checking trader 0x6200bf2a60f0174a3def2a82617153cbe6641f52\n",
|
328 |
+
"statking label \n",
|
329 |
+
"checking trader 0x7d3a0da18e14ccb63375cdc250e8a8399997816f\n",
|
330 |
+
"trader address not found in the service map\n",
|
331 |
+
"statking label \n",
|
332 |
+
"checking trader 0xdd9de3412e91d958b0ccfd447d671a4ac1fb7866\n",
|
333 |
+
"statking label \n",
|
334 |
+
"checking trader 0xca74e5dc5a8941b41858d597125071284572e9c6\n",
|
335 |
+
"statking label \n",
|
336 |
+
"checking trader 0x217dc62fca6027231a8b954e333d088375fe21d0\n",
|
337 |
+
"statking label \n"
|
338 |
+
]
|
339 |
+
},
|
340 |
+
{
|
341 |
+
"name": "stderr",
|
342 |
+
"output_type": "stream",
|
343 |
+
"text": [
|
344 |
+
"Labeling traders by staking: 77%|███████▋ | 157/204 [00:00<00:00, 393.35trader/s]"
|
345 |
+
]
|
346 |
+
},
|
347 |
+
{
|
348 |
+
"name": "stdout",
|
349 |
+
"output_type": "stream",
|
350 |
+
"text": [
|
351 |
+
"checking trader 0x64b9afc7343374b8b89a6a83d56e859349722115\n",
|
352 |
+
"statking label \n",
|
353 |
+
"checking trader 0xe3483992c90fff85ce99b8047ff5988d6a4a9ad9\n",
|
354 |
+
"statking label quickstart\n",
|
355 |
+
"checking trader 0xca6a7735745ab50ba3831ad92437fbb4a49474e4\n",
|
356 |
+
"statking label \n",
|
357 |
+
"checking trader 0x36ff6381fd5f30c06428b47ed36ee0f8a018d49e\n",
|
358 |
+
"statking label \n",
|
359 |
+
"checking trader 0xd75b30e0f3093a3a4c90bb14028a21684047884c\n",
|
360 |
+
"statking label \n",
|
361 |
+
"checking trader 0x20a55f64186b467fa67df63c2b8d2e0d84ecdaa4\n",
|
362 |
+
"statking label pearl\n",
|
363 |
+
"checking trader 0xed907a98de939f9817faa1c6e644922e3ee0cdec\n",
|
364 |
+
"statking label pearl\n",
|
365 |
+
"checking trader 0x360e606b22df1f808366255ef0bbefa425f570f4\n",
|
366 |
+
"statking label pearl\n",
|
367 |
+
"checking trader 0x4b9e1890640e5f56f7fdc580347c938aaab56c25\n",
|
368 |
+
"statking label pearl\n",
|
369 |
+
"checking trader 0x82f80ff2d0ebf6680c98ad8fc874990b073f25cc\n",
|
370 |
+
"statking label pearl\n",
|
371 |
+
"checking trader 0x03429c1ab7d9d14baa42ded8a2dd7d684fc950ed\n",
|
372 |
+
"statking label pearl\n",
|
373 |
+
"checking trader 0x66a022b113b41e08d90cfd9468b8b6565d6ea995\n",
|
374 |
+
"statking label pearl\n",
|
375 |
+
"checking trader 0xfaa64c148c32af3552413438ec78599bffbd077a\n",
|
376 |
+
"statking label pearl\n",
|
377 |
+
"checking trader 0xfd5f7d27f31aea2fdba38ced1c2a3ace4bf41c64\n",
|
378 |
+
"trader address not found in the service map\n",
|
379 |
+
"statking label \n",
|
380 |
+
"checking trader 0x23651c17d74e6b44808224cf77069dae3cbafec1\n",
|
381 |
+
"statking label pearl\n",
|
382 |
+
"checking trader 0x11d3628a251761404a86919297a7ccf6081232a2\n",
|
383 |
+
"statking label pearl\n",
|
384 |
+
"checking trader 0xc6c10307b9ae985507064a7da090bc8efce5e908\n",
|
385 |
+
"statking label \n",
|
386 |
+
"checking trader 0x4ffeaa1389ba49cd30dee138031d0c8ab3091ea4\n",
|
387 |
+
"statking label pearl\n",
|
388 |
+
"checking trader 0xe283e408c6017447da9fe092d52c386753699680\n",
|
389 |
+
"statking label pearl\n",
|
390 |
+
"checking trader 0x42a6ddcec8760f181cc2ac3ba6ebf30e9887e953\n",
|
391 |
+
"statking label \n",
|
392 |
+
"checking trader 0xe61aacd2218dda951d0d0a0c014b5cd2c0d79d9e\n",
|
393 |
+
"statking label pearl\n",
|
394 |
+
"checking trader 0x2b00ebb18be2224d60fc55ae52df5cf6177f8fb7\n",
|
395 |
+
"statking label pearl\n",
|
396 |
+
"checking trader 0xdab47894968c773be2b2205332e17f5599bc3634\n",
|
397 |
+
"statking label pearl\n",
|
398 |
+
"checking trader 0x7011de27693bd17bfc248722488aec71f8941137\n",
|
399 |
+
"statking label pearl\n",
|
400 |
+
"checking trader 0x358e58683e54b2b1b0536727df52a001df5acdf8\n",
|
401 |
+
"statking label pearl\n",
|
402 |
+
"checking trader 0xfe94203ab2c1c22fe8585cbebf865f7b69eb7027\n",
|
403 |
+
"statking label pearl\n",
|
404 |
+
"checking trader 0x1fe2b09de07475b1027b0c73a5bf52693b31a52e\n",
|
405 |
+
"statking label pearl\n",
|
406 |
+
"checking trader 0x27f64fbfcab718c03a91d9d8782ef2253f92af92\n",
|
407 |
+
"statking label pearl\n",
|
408 |
+
"checking trader 0x30071aa627e6accc474d4adaa228b2e2007576ea\n",
|
409 |
+
"statking label pearl\n",
|
410 |
+
"checking trader 0xbef5e39616ee3d565fd2c77dae89fdd5a5ec982b\n",
|
411 |
+
"statking label pearl\n",
|
412 |
+
"checking trader 0x532ac93de6fa041665fd2ea25d4232bfd0ae4553\n",
|
413 |
+
"statking label pearl\n",
|
414 |
+
"checking trader 0x5540b853357c2c04bf02896b028c1e5a8f6a114c\n",
|
415 |
+
"statking label pearl\n",
|
416 |
+
"checking trader 0x8e03d3a7a3dfd930f73577ba4204deadf12b33f3\n",
|
417 |
+
"statking label pearl\n",
|
418 |
+
"checking trader 0xdbd9367514f2ca6ff6c792fe0ee7cbdb80cc36d2\n",
|
419 |
+
"statking label pearl\n",
|
420 |
+
"checking trader 0x43ce1d7a706c7ea44d5c5b9eb9956cfc0003b9ee\n",
|
421 |
+
"statking label pearl\n",
|
422 |
+
"checking trader 0x2c83cf4bb92e55e35b6e4af6eca6c0a85fb73650\n",
|
423 |
+
"statking label pearl\n",
|
424 |
+
"checking trader 0x2cb043eb5506a5a1c71a239f62957f8b4b148978\n",
|
425 |
+
"statking label pearl\n",
|
426 |
+
"checking trader 0x51b86fccc3d92d6d2459b7a2bc6498e18bd0afa2\n",
|
427 |
+
"statking label pearl\n",
|
428 |
+
"checking trader 0x559c37c1b34a1802618a9ff36211f360ca5c5f02\n",
|
429 |
+
"statking label pearl\n",
|
430 |
+
"checking trader 0x7bcf0f480e52da1597d7437d5b4a4644b1e7ec23\n",
|
431 |
+
"statking label pearl\n",
|
432 |
+
"checking trader 0x8069ea45a18910fa493a6a736438971b0e59ec9b\n",
|
433 |
+
"statking label pearl\n",
|
434 |
+
"checking trader 0x87f0fcfe810502555f8d1439793155cbfa2eb583\n",
|
435 |
+
"statking label pearl\n",
|
436 |
+
"checking trader 0xd0b3c90682dd4abbd1135c17b39c1726b96e0f78\n",
|
437 |
+
"statking label pearl\n",
|
438 |
+
"checking trader 0xe0113a139f591efa8bf5e19308c7c27199682d77\n",
|
439 |
+
"statking label pearl\n",
|
440 |
+
"checking trader 0xe271378e094db9d64e34c6c14a7492bcccd11dfb\n",
|
441 |
+
"statking label pearl\n",
|
442 |
+
"checking trader 0x04430ebfb7d088960233b7353cb4cefb528dc31e\n",
|
443 |
+
"statking label pearl\n",
|
444 |
+
"checking trader 0x1a138c65f8423fcf144bb0fd4d5a5f8b5c99a558\n",
|
445 |
+
"statking label pearl\n",
|
446 |
+
"checking trader 0x2604cb57b88a3d1be9301b5e786d92961ea4a1d1\n",
|
447 |
+
"statking label \n",
|
448 |
+
"checking trader 0xd5fcb0db8af1c19655103c499ab7e20c58b888d4\n",
|
449 |
+
"statking label \n",
|
450 |
+
"checking trader 0xd71b78ce490776a8f0cad6876ea79bc190f7bcce\n",
|
451 |
+
"statking label pearl\n",
|
452 |
+
"checking trader 0xfe16926cefc4db4a7496bfc3e961445228fbbf39\n",
|
453 |
+
"statking label pearl\n",
|
454 |
+
"checking trader 0x0554b950e493fad8e89d7cd9d2368ffbab9d3e4e\n",
|
455 |
+
"statking label pearl\n",
|
456 |
+
"checking trader 0x913dedfcfb335a49509b67acb3b1ab2612a5c0c9\n",
|
457 |
+
"statking label pearl\n",
|
458 |
+
"checking trader 0xc5bc3ae599aa5dc2f56faeb074e0544d39193790\n",
|
459 |
+
"statking label pearl\n",
|
460 |
+
"checking trader 0x032533005f65026fa7f360ff9a211bc94315325d\n",
|
461 |
+
"statking label pearl\n",
|
462 |
+
"checking trader 0xa2247313e3a32c21866d5a7484bcc4fe466a3b94\n",
|
463 |
+
"statking label pearl\n",
|
464 |
+
"checking trader 0x5bc54e5c4b7ce1f5d006f7b0910901c1dbea8d4c\n",
|
465 |
+
"statking label pearl\n",
|
466 |
+
"checking trader 0xa1019a256cb5ef81e11809dd021269b4cafc071c\n",
|
467 |
+
"statking label pearl\n",
|
468 |
+
"checking trader 0xe27ab203204bb40d8853b4b576950ae4b407de3a\n",
|
469 |
+
"statking label pearl\n",
|
470 |
+
"checking trader 0x333dd90d00c8a46dde6a0e59569a9a8c25a9e2f4\n",
|
471 |
+
"statking label pearl\n",
|
472 |
+
"checking trader 0x4ba7229c275774e44cdde802e59e1bcf352981a7\n",
|
473 |
+
"statking label pearl\n",
|
474 |
+
"checking trader 0x1b9e28e7f817e1312636a485f31cca8a4be61fac\n",
|
475 |
+
"statking label pearl\n",
|
476 |
+
"checking trader 0x245b25aa5728368d7efafdf107f887bf3b72ce78\n",
|
477 |
+
"statking label pearl\n",
|
478 |
+
"checking trader 0x37c241945001f6c26c886c8d551cc2e6cf34c214\n",
|
479 |
+
"statking label pearl\n",
|
480 |
+
"checking trader 0x528907630bfda4f3b00580c0d7d3a69ccec62173\n",
|
481 |
+
"statking label pearl\n",
|
482 |
+
"checking trader 0x84aeb93d348c6da1ea4b0016c207aefc26edaa44\n"
|
483 |
+
]
|
484 |
+
},
|
485 |
+
{
|
486 |
+
"name": "stderr",
|
487 |
+
"output_type": "stream",
|
488 |
+
"text": [
|
489 |
+
"Labeling traders by staking: 100%|██████████| 204/204 [00:00<00:00, 415.07trader/s]\n"
|
490 |
+
]
|
491 |
+
},
|
492 |
+
{
|
493 |
+
"name": "stdout",
|
494 |
+
"output_type": "stream",
|
495 |
+
"text": [
|
496 |
+
"statking label pearl\n",
|
497 |
+
"checking trader 0x8cedb179299b99eeef4f6b231bc194952a339557\n",
|
498 |
+
"statking label pearl\n",
|
499 |
+
"checking trader 0x96d56cf7c906ab13752d5770e93e69330d050f5b\n",
|
500 |
+
"statking label pearl\n",
|
501 |
+
"checking trader 0xb972c2fdd528c3a56a6548c1247b9f68a00beae8\n",
|
502 |
+
"statking label pearl\n",
|
503 |
+
"checking trader 0xffc47cb1ecd41daae58e39fd4193d6fe9a6f5d2e\n",
|
504 |
+
"statking label pearl\n",
|
505 |
+
"checking trader 0x2ff064d951996c9fe70d6ba22d8684f37b2e24ec\n",
|
506 |
+
"trader address not found in the service map\n",
|
507 |
+
"statking label \n",
|
508 |
+
"checking trader 0xdb741a8f175b9baadd9b6777c1d57322117266e3\n",
|
509 |
+
"statking label pearl\n",
|
510 |
+
"checking trader 0x8e9d20cab5a3ed63ed7984092dd214e012a919bb\n",
|
511 |
+
"statking label pearl\n",
|
512 |
+
"checking trader 0xac3ebb0ab2e0dc9aff761a9841e91e02e537cdbf\n",
|
513 |
+
"statking label pearl\n",
|
514 |
+
"checking trader 0x6ed28d3d8996dccc661559cd34a160b18cd3c7a8\n",
|
515 |
+
"statking label \n",
|
516 |
+
"checking trader 0xc7fc9c1e1ba6bb6a49f62b7b0d8a77d6d3c9dfbc\n",
|
517 |
+
"statking label pearl\n",
|
518 |
+
"checking trader 0x6957f7ac4a0a09f237a901749e518a678d1a614a\n",
|
519 |
+
"statking label pearl\n",
|
520 |
+
"checking trader 0xe715cc8f264ab48f75bb1b5c11d7dbaf949d73c5\n",
|
521 |
+
"statking label pearl\n",
|
522 |
+
"checking trader 0x24bb7773d38fb1555fcd8be28859f679fe242dbf\n",
|
523 |
+
"statking label pearl\n",
|
524 |
+
"checking trader 0x10ece1553b5017414388fe78f64720814d7f8799\n",
|
525 |
+
"statking label pearl\n",
|
526 |
+
"checking trader 0x2ad146e33b27933241dd68eeb18e77d860ba361d\n",
|
527 |
+
"statking label pearl\n",
|
528 |
+
"checking trader 0x29e9576633cafd8b0040cd3054c190d85a97a95b\n",
|
529 |
+
"statking label pearl\n",
|
530 |
+
"checking trader 0x300e2a08034a1e2a962da72f5569fa053dfde44c\n",
|
531 |
+
"statking label pearl\n",
|
532 |
+
"checking trader 0x8969bd87b9e743d8120e41445462f0cbe29f5d7c\n",
|
533 |
+
"statking label \n",
|
534 |
+
"checking trader 0xc0de1041eaef133b72e22697a497db4f266c9584\n",
|
535 |
+
"statking label pearl\n",
|
536 |
+
"checking trader 0x047f8663b254d90d28af6d8ca7181947e94577ce\n",
|
537 |
+
"statking label pearl\n",
|
538 |
+
"checking trader 0x006f70b4e3c3a3648f31ec16b2e7106fc58166f2\n",
|
539 |
+
"statking label pearl\n",
|
540 |
+
"checking trader 0x06d873e7465a6680f5487905d7b5daf7f2c6e299\n",
|
541 |
+
"statking label pearl\n",
|
542 |
+
"checking trader 0xad8aa6f927bb6a38af8121418f1b64d4ed8be99c\n",
|
543 |
+
"statking label pearl\n",
|
544 |
+
"checking trader 0x651d04044b780e68f3f952796fb7c06fb0928ad2\n",
|
545 |
+
"statking label pearl\n",
|
546 |
+
"checking trader 0x7ddbfbebbec1635315f9217cbf9de8afd272c8de\n",
|
547 |
+
"statking label pearl\n",
|
548 |
+
"checking trader 0x3badd0a1beb34fc1532f6c717fa857b3325da184\n",
|
549 |
+
"statking label pearl\n",
|
550 |
+
"checking trader 0xe0d01efee7a9740f8e702f086dd4fcae87926abf\n",
|
551 |
+
"trader address not found in the service map\n",
|
552 |
+
"statking label \n",
|
553 |
+
"checking trader 0xd75859beb7a211f44ae613743aaae48f87844e43\n",
|
554 |
+
"statking label pearl\n",
|
555 |
+
"checking trader 0x86c250c602f9afefac6eb559bb2e2ade96c460de\n",
|
556 |
+
"statking label pearl\n",
|
557 |
+
"checking trader 0x35ba3f37a5d44ffba63aee80c74fefa6f6ac0599\n",
|
558 |
+
"statking label pearl\n",
|
559 |
+
"checking trader 0x5813be58870670255d8694aed4c8d54bbc7286cf\n",
|
560 |
+
"statking label pearl\n",
|
561 |
+
"checking trader 0x6e5d93fdcc14db02a58ace636c2dcff8db36039d\n",
|
562 |
+
"statking label pearl\n",
|
563 |
+
"checking trader 0xbc7adca303cdda308b379e8b7925789f64296ef4\n",
|
564 |
+
"statking label pearl\n",
|
565 |
+
"checking trader 0x312a3a73155aab4033134c22205d9788c3fffcfc\n",
|
566 |
+
"statking label pearl\n",
|
567 |
+
" trader_address creation_timestamp \\\n",
|
568 |
+
"0 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 2024-08-25 02:37:35+00:00 \n",
|
569 |
+
"1 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 2024-08-30 03:24:45+00:00 \n",
|
570 |
+
"2 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 2024-08-26 02:48:20+00:00 \n",
|
571 |
+
"3 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 2024-08-27 00:23:25+00:00 \n",
|
572 |
+
"4 0x022b36c50b85b8ae7addfb8a35d76c59d5814834 2024-08-28 01:41:30+00:00 \n",
|
573 |
+
"... ... ... \n",
|
574 |
+
"4867 0x35ba3f37a5d44ffba63aee80c74fefa6f6ac0599 2024-08-18 17:16:50+00:00 \n",
|
575 |
+
"4868 0x5813be58870670255d8694aed4c8d54bbc7286cf 2024-08-26 20:28:00+00:00 \n",
|
576 |
+
"4869 0x6e5d93fdcc14db02a58ace636c2dcff8db36039d 2024-09-27 17:30:25+00:00 \n",
|
577 |
+
"4870 0xbc7adca303cdda308b379e8b7925789f64296ef4 2024-09-03 08:47:50+00:00 \n",
|
578 |
+
"4871 0x312a3a73155aab4033134c22205d9788c3fffcfc 2024-09-05 02:04:55+00:00 \n",
|
579 |
+
"\n",
|
580 |
+
" market_creator staking collateral_amount \n",
|
581 |
+
"0 quickstart 0.450426 \n",
|
582 |
+
"1 quickstart 0.419662 \n",
|
583 |
+
"2 quickstart 0.641732 \n",
|
584 |
+
"3 quickstart 0.482506 \n",
|
585 |
+
"4 quickstart 0.567930 \n",
|
586 |
+
"... ... ... ... \n",
|
587 |
+
"4867 pearl pearl 0.274184 \n",
|
588 |
+
"4868 pearl pearl 1.000000 \n",
|
589 |
+
"4869 pearl pearl 0.559664 \n",
|
590 |
+
"4870 pearl pearl 1.000000 \n",
|
591 |
+
"4871 pearl pearl 1.000000 \n",
|
592 |
+
"\n",
|
593 |
+
"[4872 rows x 5 columns]\n",
|
594 |
+
"staking\n",
|
595 |
+
" 2503\n",
|
596 |
+
"quickstart 1699\n",
|
597 |
+
"pearl 670\n",
|
598 |
+
"Name: count, dtype: int64\n"
|
599 |
+
]
|
600 |
+
}
|
601 |
+
],
|
602 |
+
"source": [
|
603 |
+
"trades_df = pd.read_parquet(\"../data/all_trades_profitability.parquet\")\n",
|
604 |
+
"trades_df = label_trades_by_staking(trades_df=trades_df)\n",
|
605 |
+
"print(\n",
|
606 |
+
" trades_df[\n",
|
607 |
+
" [\n",
|
608 |
+
" \"trader_address\",\n",
|
609 |
+
" \"creation_timestamp\",\n",
|
610 |
+
" \"market_creator\",\n",
|
611 |
+
" \"staking\",\n",
|
612 |
+
" \"collateral_amount\",\n",
|
613 |
+
" ]\n",
|
614 |
+
" ]\n",
|
615 |
+
")\n",
|
616 |
+
"print(trades_df.staking.value_counts())"
|
617 |
+
]
|
618 |
+
},
|
619 |
+
{
|
620 |
+
"cell_type": "code",
|
621 |
+
"execution_count": 6,
|
622 |
+
"metadata": {},
|
623 |
+
"outputs": [
|
624 |
+
{
|
625 |
+
"data": {
|
626 |
+
"text/plain": [
|
627 |
+
"staking\n",
|
628 |
+
" 808\n",
|
629 |
+
"pearl 670\n",
|
630 |
+
"Name: count, dtype: int64"
|
631 |
+
]
|
632 |
+
},
|
633 |
+
"execution_count": 6,
|
634 |
+
"metadata": {},
|
635 |
+
"output_type": "execute_result"
|
636 |
+
}
|
637 |
+
],
|
638 |
+
"source": [
|
639 |
+
"trades_df.loc[trades_df[\"market_creator\"]==\"pearl\"].staking.value_counts()"
|
640 |
+
]
|
641 |
+
},
|
642 |
+
{
|
643 |
+
"cell_type": "code",
|
644 |
+
"execution_count": 7,
|
645 |
+
"metadata": {},
|
646 |
+
"outputs": [],
|
647 |
+
"source": [
|
648 |
+
"trades_df['staking'] = trades_df['staking'].replace({\n",
|
649 |
+
" \"\": \"non_staking\",\n",
|
650 |
+
" \"pearl\": \"staking\"\n",
|
651 |
+
"})"
|
652 |
+
]
|
653 |
+
},
|
654 |
+
{
|
655 |
+
"cell_type": "code",
|
656 |
+
"execution_count": 8,
|
657 |
+
"metadata": {},
|
658 |
+
"outputs": [
|
659 |
+
{
|
660 |
+
"data": {
|
661 |
+
"text/plain": [
|
662 |
+
"staking\n",
|
663 |
+
"non_staking 808\n",
|
664 |
+
"staking 670\n",
|
665 |
+
"Name: count, dtype: int64"
|
666 |
+
]
|
667 |
+
},
|
668 |
+
"execution_count": 8,
|
669 |
+
"metadata": {},
|
670 |
+
"output_type": "execute_result"
|
671 |
+
}
|
672 |
+
],
|
673 |
+
"source": [
|
674 |
+
"trades_df.loc[trades_df[\"market_creator\"]==\"pearl\"].staking.value_counts()"
|
675 |
+
]
|
676 |
+
},
|
677 |
+
{
|
678 |
+
"cell_type": "code",
|
679 |
+
"execution_count": 11,
|
680 |
+
"metadata": {},
|
681 |
+
"outputs": [
|
682 |
+
{
|
683 |
+
"data": {
|
684 |
+
"text/plain": [
|
685 |
+
"market_creator\n",
|
686 |
+
"quickstart 3394\n",
|
687 |
+
"pearl 1478\n",
|
688 |
+
"Name: count, dtype: int64"
|
689 |
+
]
|
690 |
+
},
|
691 |
+
"execution_count": 11,
|
692 |
+
"metadata": {},
|
693 |
+
"output_type": "execute_result"
|
694 |
+
}
|
695 |
+
],
|
696 |
+
"source": [
|
697 |
+
"trades_df.market_creator.value_counts()"
|
698 |
+
]
|
699 |
+
},
|
700 |
+
{
|
701 |
+
"cell_type": "code",
|
702 |
+
"execution_count": 12,
|
703 |
+
"metadata": {},
|
704 |
+
"outputs": [],
|
705 |
+
"source": [
|
706 |
+
"trades_all = trades_df.copy(deep=True)\n",
|
707 |
+
"trades_all[\"market_creator\"] = \"all\""
|
708 |
+
]
|
709 |
+
},
|
710 |
+
{
|
711 |
+
"cell_type": "code",
|
712 |
+
"execution_count": 13,
|
713 |
+
"metadata": {},
|
714 |
+
"outputs": [],
|
715 |
+
"source": [
|
716 |
+
"\n",
|
717 |
+
"# merging both dataframes\n",
|
718 |
+
"all_filtered_trades = pd.concat([trades_df, trades_all], ignore_index=True)\n",
|
719 |
+
"all_filtered_trades = all_filtered_trades.sort_values(\n",
|
720 |
+
" by=\"creation_timestamp\", ascending=True\n",
|
721 |
+
")"
|
722 |
+
]
|
723 |
+
},
|
724 |
+
{
|
725 |
+
"cell_type": "code",
|
726 |
+
"execution_count": 14,
|
727 |
+
"metadata": {},
|
728 |
+
"outputs": [
|
729 |
+
{
|
730 |
+
"data": {
|
731 |
+
"text/plain": [
|
732 |
+
"market_creator\n",
|
733 |
+
"all 4872\n",
|
734 |
+
"quickstart 3394\n",
|
735 |
+
"pearl 1478\n",
|
736 |
+
"Name: count, dtype: int64"
|
737 |
+
]
|
738 |
+
},
|
739 |
+
"execution_count": 14,
|
740 |
+
"metadata": {},
|
741 |
+
"output_type": "execute_result"
|
742 |
+
}
|
743 |
+
],
|
744 |
+
"source": [
|
745 |
+
"all_filtered_trades.market_creator.value_counts()"
|
746 |
+
]
|
747 |
+
},
|
748 |
+
{
|
749 |
+
"cell_type": "code",
|
750 |
+
"execution_count": 15,
|
751 |
+
"metadata": {},
|
752 |
+
"outputs": [],
|
753 |
+
"source": [
|
754 |
+
"all_filtered_trades = all_filtered_trades.loc[\n",
|
755 |
+
" all_filtered_trades[\"market_creator\"] == \"all\"\n",
|
756 |
+
"]"
|
757 |
+
]
|
758 |
+
},
|
759 |
+
{
|
760 |
+
"cell_type": "code",
|
761 |
+
"execution_count": 16,
|
762 |
+
"metadata": {},
|
763 |
+
"outputs": [
|
764 |
+
{
|
765 |
+
"data": {
|
766 |
+
"text/plain": [
|
767 |
+
"staking\n",
|
768 |
+
" 2503\n",
|
769 |
+
"quickstart 1699\n",
|
770 |
+
"pearl 670\n",
|
771 |
+
"Name: count, dtype: int64"
|
772 |
+
]
|
773 |
+
},
|
774 |
+
"execution_count": 16,
|
775 |
+
"metadata": {},
|
776 |
+
"output_type": "execute_result"
|
777 |
+
}
|
778 |
+
],
|
779 |
+
"source": [
|
780 |
+
"all_filtered_trades.staking.value_counts()"
|
781 |
+
]
|
782 |
+
},
|
783 |
+
{
|
784 |
+
"cell_type": "code",
|
785 |
+
"execution_count": null,
|
786 |
+
"metadata": {},
|
787 |
+
"outputs": [],
|
788 |
+
"source": []
|
789 |
+
}
|
790 |
+
],
|
791 |
+
"metadata": {
|
792 |
+
"kernelspec": {
|
793 |
+
"display_name": "hf_dashboards",
|
794 |
+
"language": "python",
|
795 |
+
"name": "python3"
|
796 |
+
},
|
797 |
+
"language_info": {
|
798 |
+
"codemirror_mode": {
|
799 |
+
"name": "ipython",
|
800 |
+
"version": 3
|
801 |
+
},
|
802 |
+
"file_extension": ".py",
|
803 |
+
"mimetype": "text/x-python",
|
804 |
+
"name": "python",
|
805 |
+
"nbconvert_exporter": "python",
|
806 |
+
"pygments_lexer": "ipython3",
|
807 |
+
"version": "3.12.2"
|
808 |
+
}
|
809 |
+
},
|
810 |
+
"nbformat": 4,
|
811 |
+
"nbformat_minor": 2
|
812 |
+
}
|
scripts/profitability.py
CHANGED
@@ -32,6 +32,7 @@ from pathlib import Path
|
|
32 |
from get_mech_info import DATETIME_60_DAYS_AGO
|
33 |
from utils import SUBGRAPH_API_KEY, wei_to_unit, convert_hex_to_int, _to_content
|
34 |
from queries import omen_xdai_trades_query, conditional_tokens_gc_user_query
|
|
|
35 |
|
36 |
QUERY_BATCH_SIZE = 1000
|
37 |
DUST_THRESHOLD = 10000000000000
|
@@ -573,6 +574,9 @@ def run_profitability_analysis(
|
|
573 |
print("Summarising trades...")
|
574 |
summary_df = summary_analyse(all_trades_df)
|
575 |
|
|
|
|
|
|
|
576 |
# save to parquet
|
577 |
all_trades_df.to_parquet(DATA_DIR / "all_trades_profitability.parquet", index=False)
|
578 |
summary_df.to_parquet(DATA_DIR / "summary_profitability.parquet", index=False)
|
|
|
32 |
from get_mech_info import DATETIME_60_DAYS_AGO
|
33 |
from utils import SUBGRAPH_API_KEY, wei_to_unit, convert_hex_to_int, _to_content
|
34 |
from queries import omen_xdai_trades_query, conditional_tokens_gc_user_query
|
35 |
+
from scripts.staking import label_trades_by_staking
|
36 |
|
37 |
QUERY_BATCH_SIZE = 1000
|
38 |
DUST_THRESHOLD = 10000000000000
|
|
|
574 |
print("Summarising trades...")
|
575 |
summary_df = summary_analyse(all_trades_df)
|
576 |
|
577 |
+
# add staking labels
|
578 |
+
label_trades_by_staking(trades_df=all_trades_df)
|
579 |
+
|
580 |
# save to parquet
|
581 |
all_trades_df.to_parquet(DATA_DIR / "all_trades_profitability.parquet", index=False)
|
582 |
summary_df.to_parquet(DATA_DIR / "summary_profitability.parquet", index=False)
|
scripts/staking.py
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import sys
|
3 |
+
from pathlib import Path
|
4 |
+
from typing import Any, List
|
5 |
+
from utils import RPC, DATA_DIR
|
6 |
+
import requests
|
7 |
+
from tqdm import tqdm
|
8 |
+
from web3 import Web3
|
9 |
+
import pandas as pd
|
10 |
+
import pickle
|
11 |
+
import os
|
12 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
13 |
+
|
14 |
+
NUM_WORKERS = 10
|
15 |
+
DEPRECATED_STAKING_PROGRAMS = {
|
16 |
+
"quickstart_alpha_everest": "0x5add592ce0a1B5DceCebB5Dcac086Cd9F9e3eA5C",
|
17 |
+
"quickstart_alpha_alpine": "0x2Ef503950Be67a98746F484DA0bBAdA339DF3326",
|
18 |
+
"quickstart_alpha_coastal": "0x43fB32f25dce34EB76c78C7A42C8F40F84BCD237",
|
19 |
+
}
|
20 |
+
STAKING_PROGRAMS_QS = {
|
21 |
+
"quickstart_beta_hobbyist": "0x389B46c259631Acd6a69Bde8B6cEe218230bAE8C",
|
22 |
+
"quickstart_beta_hobbyist_2": "0x238EB6993b90a978ec6AAD7530d6429c949C08DA",
|
23 |
+
"quickstart_beta_expert": "0x5344B7DD311e5d3DdDd46A4f71481bD7b05AAA3e",
|
24 |
+
"quickstart_beta_expert_2": "0xb964e44c126410df341ae04B13aB10A985fE3513",
|
25 |
+
"quickstart_beta_expert_3": "0x80faD33Cadb5F53f9D29F02Db97D682E8b101618",
|
26 |
+
}
|
27 |
+
|
28 |
+
STAKING_PROGRAMS_PEARL = {
|
29 |
+
"pearl_alpha": "0xEE9F19b5DF06c7E8Bfc7B28745dcf944C504198A",
|
30 |
+
"pearl_beta": "0xeF44Fb0842DDeF59D37f85D61A1eF492bbA6135d",
|
31 |
+
"pearl_beta_2": "0x1c2F82413666d2a3fD8bC337b0268e62dDF67434",
|
32 |
+
}
|
33 |
+
SERVICE_REGISTRY_ADDRESS = "0x9338b5153AE39BB89f50468E608eD9d764B755fD"
|
34 |
+
|
35 |
+
|
36 |
+
def _get_contract(address: str) -> Any:
|
37 |
+
w3 = Web3(Web3.HTTPProvider(RPC))
|
38 |
+
abi = _get_abi(address)
|
39 |
+
contract = w3.eth.contract(address=Web3.to_checksum_address(address), abi=abi)
|
40 |
+
return contract
|
41 |
+
|
42 |
+
|
43 |
+
def _get_abi(address: str) -> List:
|
44 |
+
contract_abi_url = (
|
45 |
+
"https://gnosis.blockscout.com/api/v2/smart-contracts/{contract_address}"
|
46 |
+
)
|
47 |
+
response = requests.get(contract_abi_url.format(contract_address=address)).json()
|
48 |
+
|
49 |
+
if "result" in response:
|
50 |
+
result = response["result"]
|
51 |
+
try:
|
52 |
+
abi = json.loads(result)
|
53 |
+
except json.JSONDecodeError:
|
54 |
+
print("Error: Failed to parse 'result' field as JSON")
|
55 |
+
sys.exit(1)
|
56 |
+
else:
|
57 |
+
abi = response.get("abi")
|
58 |
+
|
59 |
+
return abi if abi else []
|
60 |
+
|
61 |
+
|
62 |
+
def get_service_safe(service_id: int) -> str:
|
63 |
+
"""Gets the service Safe"""
|
64 |
+
service_registry = _get_contract(SERVICE_REGISTRY_ADDRESS)
|
65 |
+
service_safe_address = service_registry.functions.getService(service_id).call()[1]
|
66 |
+
return service_safe_address
|
67 |
+
|
68 |
+
|
69 |
+
def list_contract_functions(contract):
|
70 |
+
function_names = []
|
71 |
+
for item in contract.abi:
|
72 |
+
if item.get("type") == "function":
|
73 |
+
function_names.append(item.get("name"))
|
74 |
+
return function_names
|
75 |
+
|
76 |
+
|
77 |
+
def get_service_data(service_registry: Any, service_id: int) -> dict:
|
78 |
+
tmp_map = {}
|
79 |
+
# Get the list of addresses
|
80 |
+
# print(f"getting addresses from service id ={service_id}")
|
81 |
+
|
82 |
+
# available_functions = list_contract_functions(service_registry)
|
83 |
+
# print("Available Contract Functions:")
|
84 |
+
# for func in available_functions:
|
85 |
+
# print(f"- {func}")
|
86 |
+
|
87 |
+
data = service_registry.functions.getService(service_id).call()
|
88 |
+
try:
|
89 |
+
owner_data = service_registry.functions.ownerOf(service_id).call()
|
90 |
+
except Exception as e:
|
91 |
+
tqdm.write(f"Error: no owner data infor from {service_id}")
|
92 |
+
return None
|
93 |
+
# print(f"owner data = {owner_data}")
|
94 |
+
address = data[1]
|
95 |
+
state = data[-1]
|
96 |
+
# print(f"address = {address}")
|
97 |
+
# print(f"state={state}")
|
98 |
+
if address != "0x0000000000000000000000000000000000000000":
|
99 |
+
tmp_map[service_id] = {
|
100 |
+
"safe_address": address,
|
101 |
+
"state": state,
|
102 |
+
"owner_address": owner_data,
|
103 |
+
}
|
104 |
+
return tmp_map
|
105 |
+
|
106 |
+
|
107 |
+
def update_service_map(start: int = 1, end: int = 1000):
|
108 |
+
if os.path.exists(DATA_DIR / "service_map.pkl"):
|
109 |
+
with open(DATA_DIR / "service_map.pkl", "rb") as f:
|
110 |
+
service_map = pickle.load(f)
|
111 |
+
else:
|
112 |
+
service_map = {}
|
113 |
+
|
114 |
+
# we do not know which is the last service id right now
|
115 |
+
service_registry = _get_contract(SERVICE_REGISTRY_ADDRESS)
|
116 |
+
with ThreadPoolExecutor(max_workers=NUM_WORKERS) as executor:
|
117 |
+
futures = []
|
118 |
+
for service_id in range(start, end):
|
119 |
+
futures.append(
|
120 |
+
executor.submit(
|
121 |
+
get_service_data,
|
122 |
+
service_registry,
|
123 |
+
service_id,
|
124 |
+
)
|
125 |
+
)
|
126 |
+
|
127 |
+
for future in tqdm(
|
128 |
+
as_completed(futures),
|
129 |
+
total=len(futures),
|
130 |
+
desc=f"Fetching all service data from contracts",
|
131 |
+
):
|
132 |
+
partial_dict = future.result()
|
133 |
+
if partial_dict:
|
134 |
+
service_map.update(partial_dict)
|
135 |
+
|
136 |
+
with open(DATA_DIR / "service_map.pkl", "wb") as f:
|
137 |
+
pickle.dump(service_map, f)
|
138 |
+
|
139 |
+
|
140 |
+
def check_owner_staking_contract(owner_address: str) -> str:
|
141 |
+
staking = ""
|
142 |
+
owner_address = owner_address.lower()
|
143 |
+
# check quickstart staking contracts
|
144 |
+
qs_list = [x.lower() for x in STAKING_PROGRAMS_QS.values()]
|
145 |
+
if owner_address in qs_list:
|
146 |
+
return "quickstart"
|
147 |
+
|
148 |
+
# check pearl staking contracts
|
149 |
+
pearl_list = [x.lower() for x in STAKING_PROGRAMS_PEARL.values()]
|
150 |
+
if owner_address in pearl_list:
|
151 |
+
return "pearl"
|
152 |
+
|
153 |
+
# check legacy staking contracts
|
154 |
+
deprec_list = [x.lower() for x in DEPRECATED_STAKING_PROGRAMS.values()]
|
155 |
+
if owner_address in deprec_list:
|
156 |
+
return "quickstart"
|
157 |
+
|
158 |
+
return staking
|
159 |
+
|
160 |
+
|
161 |
+
def get_trader_address_staking(trader_address: str, service_map: dict) -> str:
|
162 |
+
# check if there is any service id linked with that trader address
|
163 |
+
|
164 |
+
found_key = -1
|
165 |
+
for key, value in service_map.items():
|
166 |
+
if value["safe_address"].lower() == trader_address.lower():
|
167 |
+
# found a service
|
168 |
+
found_key = key
|
169 |
+
break
|
170 |
+
|
171 |
+
if found_key == -1:
|
172 |
+
return ""
|
173 |
+
owner = service_map[found_key]["owner_address"]
|
174 |
+
return check_owner_staking_contract(owner_address=owner)
|
175 |
+
|
176 |
+
|
177 |
+
def label_trades_by_staking(trades_df: pd.DataFrame) -> pd.DataFrame:
|
178 |
+
with open(DATA_DIR / "service_map.pkl", "rb") as f:
|
179 |
+
service_map = pickle.load(f)
|
180 |
+
# get the last service id
|
181 |
+
keys = service_map.keys()
|
182 |
+
last_key = max(keys)
|
183 |
+
update_service_map(start=last_key)
|
184 |
+
all_traders = trades_df.trader_address.unique()
|
185 |
+
trades_df["staking"] = ""
|
186 |
+
for trader in tqdm(all_traders, desc="Labeling traders by staking", unit="trader"):
|
187 |
+
# tqdm.write(f"checking trader {trader}")
|
188 |
+
staking_label = get_trader_address_staking(trader, service_map)
|
189 |
+
if staking_label:
|
190 |
+
trades_df.loc[trades_df["trader_address"] == trader, "staking"] = (
|
191 |
+
staking_label
|
192 |
+
)
|
193 |
+
# tqdm.write(f"statking label {staking_label}")
|
194 |
+
return
|
195 |
+
|
196 |
+
|
197 |
+
if __name__ == "__main__":
|
198 |
+
# create_service_map()
|
199 |
+
trades_df = pd.read_parquet(DATA_DIR / "all_trades_profitability.parquet")
|
200 |
+
label_trades_by_staking(trades_df=trades_df)
|
201 |
+
print(
|
202 |
+
trades_df[
|
203 |
+
[
|
204 |
+
"trader_address",
|
205 |
+
"creation_timestamp",
|
206 |
+
"market_creator",
|
207 |
+
"staking",
|
208 |
+
"collateral_amount",
|
209 |
+
]
|
210 |
+
]
|
211 |
+
)
|
212 |
+
print(trades_df.staking.value_counts())
|
213 |
+
trades_df.to_parquet(DATA_DIR / "all_trades_profitability.parquet", index=False)
|
tabs/staking.py
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
import plotly.express as px
|
4 |
+
|
5 |
+
|
6 |
+
def get_overall_by_staking_traders(trades_df: pd.DataFrame) -> pd.DataFrame:
|
7 |
+
"""Gets the overall trades data"""
|
8 |
+
trades_count = (
|
9 |
+
trades_df.groupby(["month_year_week", "staking"], sort=False)
|
10 |
+
.size()
|
11 |
+
.reset_index()
|
12 |
+
)
|
13 |
+
trades_count.columns = trades_count.columns.astype(str)
|
14 |
+
trades_count.rename(columns={"0": "trades"}, inplace=True)
|
15 |
+
return trades_count
|
16 |
+
|
17 |
+
|
18 |
+
def plot_staking_trades_per_market_by_week(
|
19 |
+
trades_df: pd.DataFrame, market_creator: str
|
20 |
+
) -> gr.Plot:
|
21 |
+
|
22 |
+
# adding the total
|
23 |
+
trades_all = trades_df.copy(deep=True)
|
24 |
+
trades_all["market_creator"] = "all"
|
25 |
+
|
26 |
+
# choose colour
|
27 |
+
market_colour = "darkgreen"
|
28 |
+
if market_creator == "pearl":
|
29 |
+
market_colour = "purple"
|
30 |
+
elif market_creator == "quickstart":
|
31 |
+
market_colour = "goldenrod"
|
32 |
+
|
33 |
+
# merging both dataframes
|
34 |
+
all_filtered_trades = pd.concat([trades_df, trades_all], ignore_index=True)
|
35 |
+
all_filtered_trades = all_filtered_trades.sort_values(
|
36 |
+
by="creation_timestamp", ascending=True
|
37 |
+
)
|
38 |
+
|
39 |
+
all_filtered_trades = all_filtered_trades.loc[
|
40 |
+
all_filtered_trades["market_creator"] == market_creator
|
41 |
+
]
|
42 |
+
if market_creator != "all":
|
43 |
+
all_filtered_trades["staking"] = all_filtered_trades["staking"].replace(
|
44 |
+
{"": "non_staking_traders", market_creator: "staking_traders"}
|
45 |
+
)
|
46 |
+
colour_sequence = ["gray", market_colour]
|
47 |
+
categories_sorted = {"staking": ["non_staking_traders", "staking_traders"]}
|
48 |
+
else:
|
49 |
+
all_filtered_trades["staking"] = all_filtered_trades["staking"].replace(
|
50 |
+
{
|
51 |
+
"": "non_staking_traders",
|
52 |
+
"pearl": "staking_pearl_traders",
|
53 |
+
"quickstart": "staking_quickstart_traders",
|
54 |
+
}
|
55 |
+
)
|
56 |
+
colour_sequence = ["gray", "purple", "goldenrod"]
|
57 |
+
categories_sorted = {
|
58 |
+
"staking": [
|
59 |
+
"non_staking_traders",
|
60 |
+
"staking_pearl_traders",
|
61 |
+
"staking_quickstart_traders",
|
62 |
+
]
|
63 |
+
}
|
64 |
+
trades = get_overall_by_staking_traders(all_filtered_trades)
|
65 |
+
fig = px.bar(
|
66 |
+
trades,
|
67 |
+
x="month_year_week",
|
68 |
+
y="trades",
|
69 |
+
color="staking",
|
70 |
+
barmode="group",
|
71 |
+
color_discrete_sequence=colour_sequence,
|
72 |
+
category_orders=categories_sorted,
|
73 |
+
)
|
74 |
+
|
75 |
+
fig.update_layout(
|
76 |
+
xaxis_title="Week",
|
77 |
+
yaxis_title="Weekly nr of trades",
|
78 |
+
legend=dict(yanchor="top", y=0.5),
|
79 |
+
width=1000, # Adjusted for better fit on laptop screens
|
80 |
+
height=600, # Adjusted for better fit on laptop screens
|
81 |
+
)
|
82 |
+
fig.update_xaxes(tickformat="%b %d\n%Y")
|
83 |
+
return gr.Plot(value=fig)
|