rosacastillo
commited on
Commit
·
2ca4655
1
Parent(s):
ed33e36
script for daily info
Browse files- scripts/daily_data.py +31 -0
scripts/daily_data.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from utils import measure_execution_time
|
3 |
+
from pull_data import DATA_DIR
|
4 |
+
from tools import DEFAULT_FILENAME as TOOLS_FILENAME, generate_tools_file
|
5 |
+
from profitability import (
|
6 |
+
analyse_all_traders,
|
7 |
+
label_trades_by_staking,
|
8 |
+
)
|
9 |
+
import pandas as pd
|
10 |
+
|
11 |
+
logging.basicConfig(level=logging.INFO)
|
12 |
+
|
13 |
+
|
14 |
+
@measure_execution_time
|
15 |
+
def prepare_live_metrics(
|
16 |
+
tools_filename="new_tools.parquet", trades_filename="new_fpmmTrades.parquet"
|
17 |
+
):
|
18 |
+
fpmmTrades = pd.read_parquet(DATA_DIR / trades_filename)
|
19 |
+
tools = pd.read_parquet(DATA_DIR / tools_filename)
|
20 |
+
print("Analysing trades...")
|
21 |
+
all_trades_df = analyse_all_traders(fpmmTrades, tools, daily_info=True)
|
22 |
+
|
23 |
+
# staking label
|
24 |
+
label_trades_by_staking(all_trades_df)
|
25 |
+
|
26 |
+
# save into a separate file
|
27 |
+
all_trades_df.to_parquet(DATA_DIR / "daily_info.parquet", index=False)
|
28 |
+
|
29 |
+
|
30 |
+
if __name__ == "__main__":
|
31 |
+
prepare_live_metrics()
|