cyberosa commited on
Commit
e93a0eb
·
1 Parent(s): 599eb7e

updating scripts and fixing tools dataset formatting

Browse files
active_traders.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4920473660e5ba2cd0bf9dc94e66b8745c07ba750e562e8b5f30c68c3848c92b
3
- size 17752751
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:758acea11e711b8b8313ee6b77674f57faeee27092efb894c04076912b88dbdb
3
+ size 17685882
closed_market_metrics.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:de1ee1a72efc5f66a33da10a1b1cdb1267d7a6317be11bb53abc3f71b09b51b0
3
- size 146882
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7120fb45b2b5b36026d5059fab031a5f1b7e7261f2e37dfcacc57498b729a25
3
+ size 148267
daily_mech_requests.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c0d67df0c61fd3839fe428f8f8ac338b609c271f7d2decafd1169d3543bdcdc3
3
- size 10461
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e55d48a508904db090e14a6a7a76eecf5dbd23a51e3b9f47885eeeab5019ba9
3
+ size 7898
daily_mech_requests_by_pearl_agents.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8b62a79931955d91377c4b74a3899fc6c93edf534faea61027a3c43242f3d796
3
- size 4604
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ab62a6977ebd86a8b9dbacf4c681bc069f17220ab3f6e2dbbdfab43bce1721c
3
+ size 4562
error_by_markets.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7e766e4a9904f62f30da19c25a25978b3b9211c0523b1d6abd1a98c98f1d3658
3
- size 11623
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1dfa3da5d804cf5743d2598859c9cc83be31e6cc36f65c6b076b6dcc3da18f26
3
+ size 11292
errors_by_mech.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d26c48f29c4e894488213ef301657f0a35166afb5c3cbaf8aa3718cbc19cc888
3
- size 6121
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2af6f33102419e86711524f20f98901064dd1cf46e148a0dd18d2029729fe4b
3
+ size 6113
latest_result_DAA_Pearl.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:19afc3a3321ef57688c036a21a2f140ff7d9b2cfbce13fe6fc4b38f7fe43efed
3
- size 5477
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeda67495aae91bddaf110e51cef01b15aef669a897201ad34fad5919f4d2237
3
+ size 5480
latest_result_DAA_QS.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c9e8b1bfd9a72c547f713de0bb97f7fe5cd5d224ddf22b876bdb1559576ac857
3
- size 6080
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec9f2cc2913f2c45eff40a41aff4d6c64739bb12a2cdfbdcbae98247b3115eaa
3
+ size 6088
pearl_agents.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9ecea205f6cd7377df8a5968bd271c9fcfb18378f01012cf0f218c2802528bf6
3
- size 47398
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:057b013ff3025bc4b6207017c7392d95eeceac71ce7c34e338af21571c777f40
3
+ size 47390
scripts/market_metrics.py CHANGED
@@ -76,12 +76,11 @@ def prepare_traders_data() -> Tuple[pd.DataFrame, pd.DataFrame]:
76
  # filter the mech requests done these traders on closed markets
77
  try:
78
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
79
- tools_df = prepare_tools(tools_df)
80
  except Exception as e:
81
  print(f"Error reading tools parquet file {e}")
82
  return None
83
- # remove the market_creator all category
84
- tools_df = tools_df[tools_df["market_creator"] != "all"]
85
  traders_activity = tools_df[
86
  tools_df["trader_address"].isin(unique_addresses)
87
  ].copy()
 
76
  # filter the mech requests done these traders on closed markets
77
  try:
78
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
79
+ tools_df = prepare_tools(tools_df, total_included=False)
80
  except Exception as e:
81
  print(f"Error reading tools parquet file {e}")
82
  return None
83
+
 
84
  traders_activity = tools_df[
85
  tools_df["trader_address"].isin(unique_addresses)
86
  ].copy()
scripts/predict_kpis.py CHANGED
@@ -274,12 +274,11 @@ def get_mech_requests_on_closed_markets_by_pearl_agents(
274
  # filter the mech requests done by agents on closed markets
275
  try:
276
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
277
- tools_df = prepare_tools(tools_df)
278
  except Exception as e:
279
  print(f"Error reading tools parquet file {e}")
280
  return None
281
- # remove the market_creator= "all" entries
282
- tools_df = tools_df[tools_df["market_creator"] != "all"]
283
  agents_activity = tools_df[tools_df["trader_address"].isin(unique_addresses)].copy()
284
  agents_activity = agents_activity[agents_activity["title"].isin(closed_markets)]
285
  if len(agents_activity) > 0:
 
274
  # filter the mech requests done by agents on closed markets
275
  try:
276
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
277
+ tools_df = prepare_tools(tools_df, total_included=False)
278
  except Exception as e:
279
  print(f"Error reading tools parquet file {e}")
280
  return None
281
+
 
282
  agents_activity = tools_df[tools_df["trader_address"].isin(unique_addresses)].copy()
283
  agents_activity = agents_activity[agents_activity["title"].isin(closed_markets)]
284
  if len(agents_activity) > 0:
scripts/pull_data.py CHANGED
@@ -141,7 +141,7 @@ def only_new_weekly_analysis():
141
  except Exception as e:
142
  print("Error cleaning the oldest information from parquet files")
143
  print(f"reason = {e}")
144
- # compute_tools_accuracy()
145
  compute_tools_based_datasets()
146
  # move to tmp folder the new generated files
147
  move_files()
 
141
  except Exception as e:
142
  print("Error cleaning the oldest information from parquet files")
143
  print(f"reason = {e}")
144
+ compute_tools_accuracy()
145
  compute_tools_based_datasets()
146
  # move to tmp folder the new generated files
147
  move_files()
scripts/tools_metrics.py CHANGED
@@ -50,9 +50,9 @@ def get_tool_winning_rate_by_market(tools_df: pd.DataFrame) -> pd.DataFrame:
50
  return wins
51
 
52
 
53
- def prepare_tools(tools: pd.DataFrame) -> pd.DataFrame:
54
  # remove non relevant tools
55
- tools_df = tools[tools["tool"].isin(INC_TOOLS)]
56
  tools["request_time"] = pd.to_datetime(tools["request_time"], utc=True)
57
  tools = tools.sort_values(by="request_time", ascending=True)
58
  tools["request_date"] = tools["request_time"].dt.date
@@ -62,11 +62,12 @@ def prepare_tools(tools: pd.DataFrame) -> pd.DataFrame:
62
  .dt.start_time.dt.strftime("%b-%d-%Y")
63
  )
64
  # preparing the tools graph
65
- # adding the total
66
- tools_all = tools.copy(deep=True)
67
- tools_all["market_creator"] = "all"
68
- # merging both dataframes
69
- tools = pd.concat([tools, tools_all], ignore_index=True)
 
70
  tools = tools.sort_values(by="request_time", ascending=True)
71
  return tools
72
 
@@ -110,14 +111,13 @@ def compute_tools_based_datasets():
110
  print("Computing tools based datasets")
111
  try:
112
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
113
- tools_df = prepare_tools(tools_df)
114
  except Exception as e:
115
  print(f"Error reading tools parquet file {e}")
116
  return None
117
 
118
  # mech tool errors by markets
119
  print("Computing mech tool errors by markets")
120
- tool_error_by_markets = get_error_data_by_market(tools_df=tools_df)
121
  tool_error_by_markets.to_parquet(ROOT_DIR / "error_by_markets.parquet", index=False)
122
  try:
123
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
@@ -131,7 +131,7 @@ def compute_tools_based_datasets():
131
  # all errors by mech address
132
  try:
133
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
134
- tools_df = prepare_tools(tools_df)
135
  except Exception as e:
136
  print(f"Error reading tools parquet file {e}")
137
  return None
@@ -140,7 +140,7 @@ def compute_tools_based_datasets():
140
 
141
  try:
142
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
143
- tools_df = prepare_tools(tools_df)
144
  except Exception as e:
145
  print(f"Error reading tools parquet file {e}")
146
  return None
 
50
  return wins
51
 
52
 
53
+ def prepare_tools(tools: pd.DataFrame, total_included: bool = True) -> pd.DataFrame:
54
  # remove non relevant tools
55
+ tools = tools[tools["tool"].isin(INC_TOOLS)]
56
  tools["request_time"] = pd.to_datetime(tools["request_time"], utc=True)
57
  tools = tools.sort_values(by="request_time", ascending=True)
58
  tools["request_date"] = tools["request_time"].dt.date
 
62
  .dt.start_time.dt.strftime("%b-%d-%Y")
63
  )
64
  # preparing the tools graph
65
+ if total_included:
66
+ # adding the total
67
+ tools_all = tools.copy(deep=True)
68
+ tools_all["market_creator"] = "all"
69
+ # merging both dataframes
70
+ tools = pd.concat([tools, tools_all], ignore_index=True)
71
  tools = tools.sort_values(by="request_time", ascending=True)
72
  return tools
73
 
 
111
  print("Computing tools based datasets")
112
  try:
113
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
 
114
  except Exception as e:
115
  print(f"Error reading tools parquet file {e}")
116
  return None
117
 
118
  # mech tool errors by markets
119
  print("Computing mech tool errors by markets")
120
+ tool_error_by_markets = get_error_data_by_market(tools_df=prepare_tools(tools_df))
121
  tool_error_by_markets.to_parquet(ROOT_DIR / "error_by_markets.parquet", index=False)
122
  try:
123
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
 
131
  # all errors by mech address
132
  try:
133
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
134
+ tools_df = prepare_tools(tools_df, total_included=False)
135
  except Exception as e:
136
  print(f"Error reading tools parquet file {e}")
137
  return None
 
140
 
141
  try:
142
  tools_df = pd.read_parquet(TMP_DIR / "tools.parquet")
143
+ tools_df = prepare_tools(tools_df, total_included=False)
144
  except Exception as e:
145
  print(f"Error reading tools parquet file {e}")
146
  return None
service_map.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:304f0da120f077cc0b44cef4fb02036a7abdfdb3f6ac076295ea78e51960dca3
3
- size 171677
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a57a72dabfe6bbd40f7920a0c63aeb78a7a3b062a162820b5b26f792034f00ad
3
+ size 171919
traders_weekly_metrics.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e0792f4ff5721d0db7853289260f88996c4caa74d2a6fa5838bf2b49ecfe5d87
3
- size 185731
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cad3713e1facc808f51ad50dcc7fc24c58ec518f6fe6dc03b6cd6df9c87fe255
3
+ size 185719
two_weeks_avg_roi_pearl_agents.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c9841aaf46bad1ec6d3908bae969f5b32740136551a5c1e5a99eca30a6aee5d3
3
  size 3057
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:41f0e258968cf19d0eba324f46aafb132268c7f231bce3e4b3ca096af82a0047
3
  size 3057
weekly_avg_roi_pearl_agents.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:58aabb963f14b61ed09680126afb3f481e7c46ecc3803074ab5db15875fce084
3
  size 2413
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc1090d6d97161ef6d78812eb7ba114359f6c1a502eca9c108aae889019e9e17
3
  size 2413
winning_df.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dfda6f144788f1049549a9f612dd83953d228024c74e143b36e5fdb1c1d6ab21
3
- size 11792
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:172af57bf533fb8d38f5b651ff3e029f70bdd22981a109ff59fb0656bcaccbf6
3
+ size 11798