cyberosa
commited on
Commit
·
c90b121
1
Parent(s):
0969e80
updating extreme cases
Browse files- tabs/tokens_dist.py +6 -2
tabs/tokens_dist.py
CHANGED
@@ -4,7 +4,7 @@ import matplotlib.pyplot as plt
|
|
4 |
import seaborn as sns
|
5 |
from seaborn import FacetGrid
|
6 |
import plotly.express as px
|
7 |
-
import
|
8 |
from typing import Tuple
|
9 |
|
10 |
|
@@ -63,7 +63,11 @@ def get_based_votes_distribution(market_id: str, all_markets: pd.DataFrame):
|
|
63 |
def get_extreme_cases(live_fpmms: pd.DataFrame) -> Tuple:
|
64 |
"""Function to return the id of the best and worst case according to the dist gap metric"""
|
65 |
# select markets with some trades
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
selected_markets.sort_values(by="dist_gap_perc", ascending=False, inplace=True)
|
68 |
return (
|
69 |
selected_markets.iloc[-1].id,
|
|
|
4 |
import seaborn as sns
|
5 |
from seaborn import FacetGrid
|
6 |
import plotly.express as px
|
7 |
+
from datetime import datetime, UTC
|
8 |
from typing import Tuple
|
9 |
|
10 |
|
|
|
63 |
def get_extreme_cases(live_fpmms: pd.DataFrame) -> Tuple:
|
64 |
"""Function to return the id of the best and worst case according to the dist gap metric"""
|
65 |
# select markets with some trades
|
66 |
+
today = datetime.now(UTC).date()
|
67 |
+
live_fpmms["sample_date"] = pd.to_datetime(live_fpmms["sample_timestamp"]).dt.date
|
68 |
+
selected_markets = live_fpmms.loc[
|
69 |
+
(live_fpmms["total_trades"] > 0) and (live_fpmms["sample_date"] == today)
|
70 |
+
]
|
71 |
selected_markets.sort_values(by="dist_gap_perc", ascending=False, inplace=True)
|
72 |
return (
|
73 |
selected_markets.iloc[-1].id,
|