feat: add daily 24h PnL Telegram report and stop tracking .env
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -267,11 +267,19 @@ class Monitor(HTS):
|
||||
def load_balances_dict(self) -> dict:
|
||||
"""getBalances() 결과를 currency 키 dict로 변환."""
|
||||
tmps = self.getBalances()
|
||||
balances = {}
|
||||
balances: dict = {}
|
||||
if isinstance(tmps, dict):
|
||||
if tmps.get("error"):
|
||||
raise RuntimeError(f"getBalances: {tmps.get('error')}")
|
||||
return balances
|
||||
if not isinstance(tmps, list):
|
||||
raise RuntimeError(f"getBalances unexpected: {type(tmps)}")
|
||||
for tmp in tmps:
|
||||
if not isinstance(tmp, dict) or "currency" not in tmp:
|
||||
continue
|
||||
balances[tmp["currency"]] = {
|
||||
"balance": float(tmp["balance"]),
|
||||
"avg_buy_price": float(tmp["avg_buy_price"]),
|
||||
"avg_buy_price": float(tmp.get("avg_buy_price") or 0),
|
||||
}
|
||||
return balances
|
||||
|
||||
|
||||
Reference in New Issue
Block a user