cyberosa commited on
Commit
23d3748
·
1 Parent(s): ec49da1

updating scripts and files. New daily mech requests

Browse files
active_traders.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:63915393826a96a22249488ce0e3e47f1a54a321f03b57d4c62b27ecce7c1cf0
3
- size 78415
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afa2963974e26305f2eb80c1a8b81ae92e96715f77e1dc5fca3232dace3cbf80
3
+ size 78737
all_trades_profitability.parquet.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e074711a33854d33dbb70928d7212a8d89c0d254f73ff5eeeceedfbf8e64941e
3
- size 10364305
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:101588d2abab3928941a9f00c3994f35866b9b9d0ba02ca327f2a07540945256
3
+ size 10304115
closed_market_metrics.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:26e19928cb7c8eb959a388eddab7e5f9e751d43b12da713e1126fc06c5beee40
3
- size 134822
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfccc6385bd2787166fe082ff077afbb843f0c11765075e68bb3f262c93e0962
3
+ size 135945
closed_markets_div.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eafbbfc41ed3ed223d7f8172b41820002771d64fb94772e00d746326bd6735b4
3
- size 85651
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30edfb7d4327c0c54dc6495ed9e73ddf510ad02d1b3c2f99d5862ad4108a6f4b
3
+ size 85582
daily_info.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:920a40250e0e65ad0f872a5f86bee58e856261ce7a54c0c9d98f391a25a97ee2
3
- size 2614667
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed72b83df91c1c7e6348333dd2ede46b59cf1028b3411e2f0e3f5291da739763
3
+ size 2726173
daily_mech_requests.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a074e073d5cb0200eac4032a2b5663a4286c41a5ed6f0d675ee2e146aa284c36
3
+ size 10572
error_by_markets.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7311ac85a3fccb2f4df39a06a846d08a2c3ef344cec74db64929903ad87705c0
3
- size 12323
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:186fbeade1cf969fccf481d45883379cc23ccfffa2861c9fdb721be04ac0865a
3
+ size 12610
invalid_trades.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:367a9bb77d8fe14f136bb9f41de083d497722edd225a0b7b1683d704d4d296a1
3
- size 788314
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15918f750bd4363d80fff3363271e4afc5001ca97069a6d15290645fc685f381
3
+ size 769743
retention_activity.parquet.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4b9e0109a1dafbbc154982f11fba094e703ce51096726e47d25e5ab9aa698ec0
3
- size 7797633
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f51f05bbb1e0e544b081a9864f395e1e2f306d349c3f61d7ff0bc535cf8c2a7
3
+ size 7882734
scripts/daily_data.py CHANGED
@@ -1,5 +1,5 @@
1
  import logging
2
- from utils import measure_execution_time, ROOT_DIR, TMP_DIR
3
  from profitability import (
4
  analyse_all_traders,
5
  label_trades_by_staking,
@@ -8,7 +8,6 @@ import pandas as pd
8
  from nr_mech_calls import (
9
  create_unknown_traders_df,
10
  compute_daily_mech_calls,
11
- transform_to_datetime,
12
  )
13
  from markets import check_current_week_data
14
  from staking import generate_retention_activity_file
 
1
  import logging
2
+ from utils import measure_execution_time, ROOT_DIR, TMP_DIR, transform_to_datetime
3
  from profitability import (
4
  analyse_all_traders,
5
  label_trades_by_staking,
 
8
  from nr_mech_calls import (
9
  create_unknown_traders_df,
10
  compute_daily_mech_calls,
 
11
  )
12
  from markets import check_current_week_data
13
  from staking import generate_retention_activity_file
scripts/gnosis_timestamps.py CHANGED
@@ -134,7 +134,7 @@ def compute_request_time(tools_df: pd.DataFrame) -> pd.DataFrame:
134
  tools_df.at[i, "request_time"] = timestamp
135
  # creating other time fields
136
  tools_df["request_month_year"] = pd.to_datetime(
137
- tools_df["request_time"]
138
  ).dt.strftime("%Y-%m")
139
  tools_df["request_month_year_week"] = (
140
  pd.to_datetime(tools_df["request_time"])
 
134
  tools_df.at[i, "request_time"] = timestamp
135
  # creating other time fields
136
  tools_df["request_month_year"] = pd.to_datetime(
137
+ tools_df["request_time"], utc=True
138
  ).dt.strftime("%Y-%m")
139
  tools_df["request_month_year_week"] = (
140
  pd.to_datetime(tools_df["request_time"])
scripts/{num_mech_calls.py → mech_calls_file_generator.py} RENAMED
@@ -30,7 +30,7 @@ def compute_total_mech_calls():
30
  try:
31
  print("Reading tools file")
32
  tools = pd.read_parquet(TMP_DIR / "tools.parquet")
33
- tools["request_time"] = pd.to_datetime(tools["request_time"])
34
  tools["request_date"] = tools["request_time"].dt.date
35
  tools = tools.sort_values(by="request_time", ascending=True)
36
  tools["month_year_week"] = (
 
30
  try:
31
  print("Reading tools file")
32
  tools = pd.read_parquet(TMP_DIR / "tools.parquet")
33
+ tools["request_time"] = pd.to_datetime(tools["request_time"], utc=True)
34
  tools["request_date"] = tools["request_time"].dt.date
35
  tools = tools.sort_values(by="request_time", ascending=True)
36
  tools["month_year_week"] = (
scripts/nr_mech_calls.py CHANGED
@@ -1,7 +1,6 @@
1
  import pandas as pd
2
- from utils import ROOT_DIR, DEFAULT_MECH_FEE, TMP_DIR, transform_to_datetime
3
  from tqdm import tqdm
4
-
5
  from typing import Dict, Any
6
  from collections import defaultdict
7
  from tools import IRRELEVANT_TOOLS
@@ -138,7 +137,7 @@ def compute_daily_mech_calls(
138
  fpmmTrades["creation_timestamp"] = pd.to_datetime(fpmmTrades["creationTimestamp"])
139
  fpmmTrades["creation_date"] = fpmmTrades["creation_timestamp"].dt.date
140
  fpmmTrades = fpmmTrades.sort_values(by="creation_timestamp", ascending=True)
141
- tools["request_time"] = pd.to_datetime(tools["request_time"])
142
  tools["request_date"] = tools["request_time"].dt.date
143
  tools = tools.sort_values(by="request_time", ascending=True)
144
  all_mech_calls = []
@@ -240,7 +239,7 @@ def compute_mech_calls_based_on_timestamps(
240
  fpmmTrades["creation_timestamp"] = pd.to_datetime(fpmmTrades["creationTimestamp"])
241
  fpmmTrades["creation_date"] = fpmmTrades["creation_timestamp"].dt.date
242
  fpmmTrades = fpmmTrades.sort_values(by="creation_timestamp", ascending=True)
243
- tools["request_time"] = pd.to_datetime(tools["request_time"])
244
  tools["request_date"] = tools["request_time"].dt.date
245
  tools = tools.sort_values(by="request_time", ascending=True)
246
  all_mech_calls = []
@@ -258,11 +257,4 @@ def compute_mech_calls_based_on_timestamps(
258
 
259
 
260
  if __name__ == "__main__":
261
- # update_trade_nr_mech_calls(non_agents=True)
262
- tools = pd.read_parquet(TMP_DIR / "tools.parquet")
263
- fpmmTrades = pd.read_parquet(TMP_DIR / "fpmmTrades.parquet")
264
- fpmmTrades["creationTimestamp"] = fpmmTrades["creationTimestamp"].apply(
265
- lambda x: transform_to_datetime(x)
266
- )
267
- result = compute_mech_calls_based_on_timestamps(fpmmTrades=fpmmTrades, tools=tools)
268
- result.to_parquet(TMP_DIR / "result_df.parquet", index=False)
 
1
  import pandas as pd
2
+ from utils import ROOT_DIR, DEFAULT_MECH_FEE
3
  from tqdm import tqdm
 
4
  from typing import Dict, Any
5
  from collections import defaultdict
6
  from tools import IRRELEVANT_TOOLS
 
137
  fpmmTrades["creation_timestamp"] = pd.to_datetime(fpmmTrades["creationTimestamp"])
138
  fpmmTrades["creation_date"] = fpmmTrades["creation_timestamp"].dt.date
139
  fpmmTrades = fpmmTrades.sort_values(by="creation_timestamp", ascending=True)
140
+ tools["request_time"] = pd.to_datetime(tools["request_time"], utc=True)
141
  tools["request_date"] = tools["request_time"].dt.date
142
  tools = tools.sort_values(by="request_time", ascending=True)
143
  all_mech_calls = []
 
239
  fpmmTrades["creation_timestamp"] = pd.to_datetime(fpmmTrades["creationTimestamp"])
240
  fpmmTrades["creation_date"] = fpmmTrades["creation_timestamp"].dt.date
241
  fpmmTrades = fpmmTrades.sort_values(by="creation_timestamp", ascending=True)
242
+ tools["request_time"] = pd.to_datetime(tools["request_time"], utc=True)
243
  tools["request_date"] = tools["request_time"].dt.date
244
  tools = tools.sort_values(by="request_time", ascending=True)
245
  all_mech_calls = []
 
257
 
258
 
259
  if __name__ == "__main__":
260
+ print("Nothing to do")
 
 
 
 
 
 
 
scripts/profitability.py CHANGED
@@ -37,11 +37,11 @@ from utils import (
37
  DEFAULT_MECH_FEE,
38
  TMP_DIR,
39
  measure_execution_time,
 
40
  )
41
  from staking import label_trades_by_staking
42
  from nr_mech_calls import (
43
  create_unknown_traders_df,
44
- transform_to_datetime,
45
  compute_mech_calls_based_on_timestamps,
46
  )
47
 
 
37
  DEFAULT_MECH_FEE,
38
  TMP_DIR,
39
  measure_execution_time,
40
+ transform_to_datetime,
41
  )
42
  from staking import label_trades_by_staking
43
  from nr_mech_calls import (
44
  create_unknown_traders_df,
 
45
  compute_mech_calls_based_on_timestamps,
46
  )
47
 
scripts/pull_data.py CHANGED
@@ -135,7 +135,7 @@ def only_new_weekly_analysis():
135
 
136
  save_historical_data()
137
  try:
138
- clean_old_data_from_parquet_files("2024-12-09")
139
  except Exception as e:
140
  print("Error cleaning the oldest information from parquet files")
141
  print(f"reason = {e}")
 
135
 
136
  save_historical_data()
137
  try:
138
+ clean_old_data_from_parquet_files("2024-12-11")
139
  except Exception as e:
140
  print("Error cleaning the oldest information from parquet files")
141
  print(f"reason = {e}")
scripts/tools_metrics.py CHANGED
@@ -57,9 +57,9 @@ def get_tool_winning_rate_by_market(
57
 
58
 
59
  def prepare_tools(tools: pd.DataFrame) -> pd.DataFrame:
60
- tools["request_time"] = pd.to_datetime(tools["request_time"])
61
  tools = tools.sort_values(by="request_time", ascending=True)
62
-
63
  tools["request_month_year_week"] = (
64
  pd.to_datetime(tools["request_time"])
65
  .dt.to_period("W")
@@ -80,8 +80,18 @@ def compute_tools_based_datasets():
80
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
81
  tools_df = prepare_tools(tools_df)
82
  except Exception as e:
83
- print(f"Error reading old tools parquet file {e}")
84
  return None
 
 
 
 
 
 
 
 
 
 
85
  # error by markets
86
  error_by_markets = get_error_data_by_market(tools_df=tools_df, inc_tools=INC_TOOLS)
87
  error_by_markets.to_parquet(ROOT_DIR / "error_by_markets.parquet", index=False)
@@ -89,7 +99,11 @@ def compute_tools_based_datasets():
89
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
90
  tools_df = prepare_tools(tools_df)
91
  except Exception as e:
92
- print(f"Error reading old tools parquet file {e}")
93
  return None
94
  winning_df = get_tool_winning_rate_by_market(tools_df, inc_tools=INC_TOOLS)
95
  winning_df.to_parquet(ROOT_DIR / "winning_df.parquet", index=False)
 
 
 
 
 
57
 
58
 
59
  def prepare_tools(tools: pd.DataFrame) -> pd.DataFrame:
60
+ tools["request_time"] = pd.to_datetime(tools["request_time"], utc=True)
61
  tools = tools.sort_values(by="request_time", ascending=True)
62
+ tools["request_date"] = tools["request_time"].dt.date
63
  tools["request_month_year_week"] = (
64
  pd.to_datetime(tools["request_time"])
65
  .dt.to_period("W")
 
80
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
81
  tools_df = prepare_tools(tools_df)
82
  except Exception as e:
83
+ print(f"Error reading tools parquet file {e}")
84
  return None
85
+
86
+ # daily mech requests
87
+ daily_mech_req_per_tool = (
88
+ tools_df.groupby(["request_date", "tool", "market_creator"])["request_id"]
89
+ .count()
90
+ .reset_index(name="total_mech_requests")
91
+ )
92
+ daily_mech_req_per_tool.to_parquet(
93
+ ROOT_DIR / "daily_mech_requests.parquet", index=False
94
+ )
95
  # error by markets
96
  error_by_markets = get_error_data_by_market(tools_df=tools_df, inc_tools=INC_TOOLS)
97
  error_by_markets.to_parquet(ROOT_DIR / "error_by_markets.parquet", index=False)
 
99
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
100
  tools_df = prepare_tools(tools_df)
101
  except Exception as e:
102
+ print(f"Error reading tools parquet file {e}")
103
  return None
104
  winning_df = get_tool_winning_rate_by_market(tools_df, inc_tools=INC_TOOLS)
105
  winning_df.to_parquet(ROOT_DIR / "winning_df.parquet", index=False)
106
+
107
+
108
+ if __name__ == "__main__":
109
+ compute_tools_based_datasets()
service_map.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:69776932572717100694b8a92d81d3569b69e1221e8a4423728c033645fee964
3
- size 174960
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d42e6adbfc63252df5180b292211cbbeb20f70f7350a4d8aec28d312e19bc63b
3
+ size 176179
tools_accuracy.csv CHANGED
@@ -1,13 +1,13 @@
1
  tool,tool_accuracy,total_requests,min,max
2
- claude-prediction-offline,57.42090202393503,86317,2024-12-09 00:03:40,2025-02-08 22:53:10
3
- claude-prediction-online,58.005167004982475,54190,2024-12-09 00:00:15,2025-02-09 01:41:10
4
- prediction-offline,59.210526315789465,161576,2024-12-09 00:00:05,2025-02-09 02:15:50
5
- prediction-offline-sme,50.1501708841095,28967,2024-12-09 00:03:25,2025-02-08 15:31:00
6
- prediction-online,50.49545829892651,4844,2024-12-09 00:40:50,2025-02-08 17:36:10
7
- prediction-online-sme,49.05218317358893,4695,2024-12-09 00:05:50,2025-02-08 17:01:45
8
- prediction-request-rag,47.74678111587983,932,2024-12-09 00:13:15,2025-02-07 19:02:55
9
- prediction-request-rag-claude,46.95187165775401,935,2024-12-09 00:30:50,2025-02-08 16:07:25
10
- prediction-request-reasoning,52.584455511407555,111242,2024-12-09 00:01:10,2025-02-08 18:21:40
11
- prediction-request-reasoning-claude,62.217659137576995,974,2024-12-09 02:09:10,2025-02-08 16:02:55
12
- prediction-url-cot-claude,53.17820658342792,1762,2024-12-09 00:05:25,2025-02-08 19:16:35
13
- superforcaster,53.81277795856384,9219,2024-12-09 00:16:25,2025-02-08 22:33:45
 
1
  tool,tool_accuracy,total_requests,min,max
2
+ claude-prediction-offline,58.01688764497995,84322,2024-12-11 00:00:35,2025-02-10 23:47:05
3
+ claude-prediction-online,58.75600044654485,53746,2024-12-11 00:00:10,2025-02-11 17:08:10
4
+ prediction-offline,59.28727182107034,160510,2024-12-11 00:00:40,2025-02-11 02:05:50
5
+ prediction-offline-sme,50.16101880992462,27326,2024-12-11 00:02:20,2025-02-10 21:58:55
6
+ prediction-online,49.9157184997893,4746,2024-12-11 00:25:45,2025-02-10 19:09:45
7
+ prediction-online-sme,49.02548725637181,4669,2024-12-11 01:28:25,2025-02-10 19:18:30
8
+ prediction-request-rag,46.76089517078916,849,2024-12-11 00:24:25,2025-02-10 17:56:20
9
+ prediction-request-rag-claude,47.38067520372526,859,2024-12-11 11:10:05,2025-02-10 12:20:15
10
+ prediction-request-reasoning,52.30039975061429,109068,2024-12-11 00:00:20,2025-02-10 20:05:45
11
+ prediction-request-reasoning-claude,62.05016357688113,917,2024-12-11 00:25:45,2025-02-10 17:44:25
12
+ prediction-url-cot-claude,53.30948121645797,1677,2024-12-11 00:25:45,2025-02-10 16:54:15
13
+ superforcaster,53.6015574302401,9246,2024-12-11 00:25:55,2025-02-10 23:53:40
unknown_traders.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:25e6c178bf0685e531e1eee1af757b862e4376fb69ad237d82716b2c712db48b
3
- size 452121
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c27ec0a3afd431bdd6ed89f4e7588a360184a1af614fb49de1dfcb005054331
3
+ size 456721
weekly_mech_calls.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a66d6db9f10d069fb2c8ea151bff47bc71d1082953400c6eef7110a3308d6102
3
- size 54223
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a07226ccc9a710811f9982db333c9657729db0dc59d30b62df10bebf087393ff
3
+ size 54791
winning_df.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2ce7cc983ceeb8ac45020ca1b6e18b9f1442ceb6093f6e5342029163fd176ec6
3
- size 11664
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d860ade624c31f4d807c1015344f5f628e94b8ae2470d6c55e669033cea78c1
3
+ size 11953