File size: 895 Bytes
09240da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import logging
from utils import measure_execution_time
from pull_data import DATA_DIR
from tools import DEFAULT_FILENAME as TOOLS_FILENAME, generate_tools_file
from profitability import (
    analyse_all_traders,
    label_trades_by_staking,
)
import pandas as pd

logging.basicConfig(level=logging.INFO)


@measure_execution_time
def prepare_live_metrics(
    tools_filename="new_tools.parquet", trades_filename="new_fpmmTrades.parquet"
):
    fpmmTrades = pd.read_parquet(DATA_DIR / trades_filename)
    tools = pd.read_parquet(DATA_DIR / tools_filename)
    print("Analysing trades...")
    all_trades_df = analyse_all_traders(fpmmTrades, tools, daily_info=True)

    # staking label
    label_trades_by_staking(all_trades_df)

    # save into a separate file
    all_trades_df.to_parquet(DATA_DIR / "daily_info.parquet", index=False)


if __name__ == "__main__":
    prepare_live_metrics()