rosacastillo commited on
Commit
0d1c710
·
1 Parent(s): ac98a26

updating weekly stats

Browse files
data/all_fpmms.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f592b1f5306ed3bacf492bdfc2f1c141abf63a65a1de5dd699d70d9be7cba684
3
+ size 411157
data/all_trades_profitability.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3e3f78f46ebb99a74a0c6965c091251c81bd283078c5a2731fa29b915e85950f
3
- size 1727275
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a12ff001752f6ca93c5ebbbf1ba39aa2c9a194d798cd4136c10bb096b8eb5490
3
+ size 698837
data/fpmmTrades.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ec5e9eac58311efb3492d93bf253993863b073b420cae74944a293c92c17fcdc
3
- size 5442383
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9cf10df0a23d3a587cccec8ed841f307feaf2d8f9b1a9e25b02468e6541fe382
3
+ size 2230205
data/fpmms.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7a7edf74b65cbed42947158ae9603a5c177d57792ff455b87dfa55f106d668cc
3
- size 419359
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b393aa9eb4ee0eb927dc87405050a0a75aa553f3b5ee05f88e9595ae535a00a0
3
+ size 428124
data/invalid_trades.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:34b27ad37752126eabf389ebadfd04d9c8da718b77355f6d26918ef8a5c98adf
3
- size 239854
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9bc7524e360c8352de0f4c4d213d10b76991196373c819a4ea00822d68e48182
3
+ size 90771
data/summary_profitability.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0b4f955e507698c53a1e04b654b098491ef0bc10c02ee55da493d8fbd5669498
3
- size 36397
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d969e863e793be8a5e871659eef73cf4029af37a3100b64243ca1cd5f74a1d1e
3
+ size 35519
data/t_map.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fbc1ee9d8b1b348606f10221c56182b4341575d84d787fb136e94ed9fbbaca9c
3
- size 16921070
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acb6bae97c67972e8943ee28cded53b7102248ea95b1d52006ed36bc1c749336
3
+ size 17302848
data/tools.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3672394d5e46d6ba2da521ee3ba098a3ac33fed4e185800ed5a2892aaf84bdf9
3
- size 394013019
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d30486693a66156d21e5149c2796a86d341f3c433aac890ea22bfa0f0fdb80f
3
+ size 365753056
data/tools_accuracy.csv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d191b7e3acb6f904b21cb0ee4ef02870500cbf9b03d59d5cd3a94469322013c0
3
- size 999
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4335a38309dcebbffe7e61d5857f3a95ca5d13f1e5c833e5aac69b6e21eaebea
3
+ size 1012
scripts/get_mech_info.py CHANGED
@@ -102,7 +102,7 @@ def fetch_block_number(timestamp_from: int, timestamp_to: int) -> dict:
102
  )
103
  # print(f"block query: {query}")
104
  result_json = response.json()
105
- # print(f"Response of the query={result_json}")
106
  blocks = result_json.get("data", {}).get("blocks", "")
107
  if len(blocks) == 0:
108
  raise ValueError(f"The query {query} did not return any results")
 
102
  )
103
  # print(f"block query: {query}")
104
  result_json = response.json()
105
+ print(f"Response of the query={result_json}")
106
  blocks = result_json.get("data", {}).get("blocks", "")
107
  if len(blocks) == 0:
108
  raise ValueError(f"The query {query} did not return any results")
scripts/mech_request_utils.py CHANGED
@@ -18,11 +18,9 @@
18
  # ------------------------------------------------------------------------------
19
 
20
  """Script for retrieving mech requests and their delivers."""
21
- import os
22
  import json
23
  import time
24
  import pickle
25
- from collections import defaultdict
26
  from typing import Any, Dict, List, Tuple
27
  from pathlib import Path
28
  import requests
@@ -338,12 +336,6 @@ def write_mech_events_to_file(
338
  last_write_time = now
339
 
340
 
341
- def save_final_tools_json_file(data: Dict[str, Any], filename: str):
342
- filename_path = DATA_DIR / filename
343
- with open(filename_path, "w", encoding="utf-8") as file:
344
- json.dump(data, file, indent=2)
345
-
346
-
347
  def save_json_file(data: Dict[str, Any], filename: str):
348
  """Function to save the content into a json file"""
349
  filename_path = JSON_DATA_DIR / filename
@@ -499,7 +491,7 @@ def get_ipfs_data():
499
  partial_dict = future.result()
500
  updated_mech_requests.update(partial_dict)
501
 
502
- save_final_tools_json_file(updated_mech_requests, "tools_info.json")
503
 
504
  # delivers
505
  print("UPDATING IPFS CONTENTS OF DELIVERS")
@@ -525,7 +517,7 @@ def get_ipfs_data():
525
  partial_dict = future.result()
526
  final_tools_content.update(partial_dict)
527
 
528
- save_final_tools_json_file(final_tools_content, "tools_info.json")
529
 
530
 
531
  def only_delivers_loop():
@@ -557,4 +549,4 @@ def only_delivers_loop():
557
  partial_dict = future.result()
558
  final_tools_content.update(partial_dict)
559
 
560
- save_final_tools_json_file(final_tools_content, "tools_info.json")
 
18
  # ------------------------------------------------------------------------------
19
 
20
  """Script for retrieving mech requests and their delivers."""
 
21
  import json
22
  import time
23
  import pickle
 
24
  from typing import Any, Dict, List, Tuple
25
  from pathlib import Path
26
  import requests
 
336
  last_write_time = now
337
 
338
 
 
 
 
 
 
 
339
  def save_json_file(data: Dict[str, Any], filename: str):
340
  """Function to save the content into a json file"""
341
  filename_path = JSON_DATA_DIR / filename
 
491
  partial_dict = future.result()
492
  updated_mech_requests.update(partial_dict)
493
 
494
+ save_json_file(updated_mech_requests, "tools_info.json")
495
 
496
  # delivers
497
  print("UPDATING IPFS CONTENTS OF DELIVERS")
 
517
  partial_dict = future.result()
518
  final_tools_content.update(partial_dict)
519
 
520
+ save_json_file(final_tools_content, "tools_info.json")
521
 
522
 
523
  def only_delivers_loop():
 
549
  partial_dict = future.result()
550
  final_tools_content.update(partial_dict)
551
 
552
+ save_json_file(final_tools_content, "tools_info.json")
scripts/profitability.py CHANGED
@@ -441,7 +441,7 @@ def analyse_trader(
441
  )
442
  except Exception:
443
  print(f"Error while getting the number of mech calls")
444
- num_mech_calls = 0 # No info
445
 
446
  net_earnings = (
447
  earnings
 
441
  )
442
  except Exception:
443
  print(f"Error while getting the number of mech calls")
444
+ num_mech_calls = 2 # Average value
445
 
446
  net_earnings = (
447
  earnings
scripts/pull_data.py CHANGED
@@ -136,8 +136,7 @@ def weekly_analysis():
136
  logging.info("Finished generating the mech json files")
137
 
138
  # Run tools ETL
139
- logging.info("Running new tools ETL")
140
- get_mech_events_last_60_days()
141
  generate_tools_file()
142
  logging.info("Tools ETL completed")
143
 
 
136
  logging.info("Finished generating the mech json files")
137
 
138
  # Run tools ETL
139
+ logging.info("Generate and parse the tools content")
 
140
  generate_tools_file()
141
  logging.info("Tools ETL completed")
142
 
scripts/tools.py CHANGED
@@ -56,6 +56,7 @@ from utils import (
56
  reduce_window,
57
  limit_text,
58
  DATA_DIR,
 
59
  REQUEST_ID_FIELD,
60
  MechEvent,
61
  MechEventName,
@@ -600,7 +601,7 @@ def parse_store_json_events_parallel(
600
  def generate_tools_file():
601
  """Function to parse the json mech events and generate the parquet tools file"""
602
  try:
603
- with open(DATA_DIR / "tools_info.json", "r") as file:
604
  file_contents = json.load(file)
605
  parse_store_json_events_parallel(file_contents)
606
  except Exception as e:
 
56
  reduce_window,
57
  limit_text,
58
  DATA_DIR,
59
+ JSON_DATA_DIR,
60
  REQUEST_ID_FIELD,
61
  MechEvent,
62
  MechEventName,
 
601
  def generate_tools_file():
602
  """Function to parse the json mech events and generate the parquet tools file"""
603
  try:
604
+ with open(JSON_DATA_DIR / "tools_info.json", "r") as file:
605
  file_contents = json.load(file)
606
  parse_store_json_events_parallel(file_contents)
607
  except Exception as e:
scripts/utils.py CHANGED
@@ -19,6 +19,7 @@ REQUEST_ID_FIELD = "request_id"
19
  SCRIPTS_DIR = Path(__file__).parent
20
  ROOT_DIR = SCRIPTS_DIR.parent
21
  DATA_DIR = ROOT_DIR / "data"
 
22
  BLOCK_FIELD = "block"
23
  CID_PREFIX = "f01701220"
24
  REQUEST_ID = "requestId"
 
19
  SCRIPTS_DIR = Path(__file__).parent
20
  ROOT_DIR = SCRIPTS_DIR.parent
21
  DATA_DIR = ROOT_DIR / "data"
22
+ JSON_DATA_DIR = ROOT_DIR / "json_data"
23
  BLOCK_FIELD = "block"
24
  CID_PREFIX = "f01701220"
25
  REQUEST_ID = "requestId"