Skip to content

Commit

Permalink
Apply Code Formatter Change
Browse files Browse the repository at this point in the history
  • Loading branch information
aoki-h-jp authored and github-actions[bot] committed Sep 8, 2023
1 parent a153c9e commit d5b9f4f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crypto_features/feature/engineering.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ def mean_liquidation(self, count_minutes: int) -> pd.Series:
:param count_minutes: minutes to calculate mean liquidation
"""
df = self.count_quote_liquidation(count_minutes).abs() / self.count_liquidation(count_minutes)
df = self.count_quote_liquidation(count_minutes).abs() / self.count_liquidation(
count_minutes
)
df = df.fillna(0)
return df.resample("1S").mean().fillna(0)

Expand Down Expand Up @@ -378,7 +380,7 @@ def ratio_quote_liquidation(self, count_minutes: int) -> pd.Series:

aggtrades["price"] = aggtrades["price"].astype(float)
aggtrades["quantity"] = aggtrades["quantity"].astype(float)
aggtrades["amount"] = (aggtrades["price"] * aggtrades["quantity"])
aggtrades["amount"] = aggtrades["price"] * aggtrades["quantity"]
index_range = pd.date_range(
start=self._start_time, end=self._end_time, freq="1S", tz="UTC"
)
Expand All @@ -392,8 +394,10 @@ def sum_amount(ts):
empty_df["aggtrade_amount"] = empty_df.index.to_series().apply(sum_amount)
empty_df["aggtrade_amount"] = empty_df["aggtrade_amount"].fillna(0)
empty_df["aggtrade_amount"] = empty_df["aggtrade_amount"].astype(float)
df = self.count_quote_liquidation(count_minutes).abs() / empty_df["aggtrade_amount"]
df = (
self.count_quote_liquidation(count_minutes).abs()
/ empty_df["aggtrade_amount"]
)
df = df.fillna(0)

return df

0 comments on commit d5b9f4f

Please sign in to comment.