chore: remove leverage from /balance endpoint

This commit is contained in:
Matthias 2024-08-15 16:59:30 +02:00
parent 756fef53f9
commit 34667c69d3
4 changed files with 2 additions and 6 deletions

View File

@ -67,7 +67,6 @@ class Balance(BaseModel):
stake: str stake: str
# Starting with 2.x # Starting with 2.x
side: str side: str
leverage: float
is_position: bool is_position: bool
position: float position: float
is_bot_managed: bool is_bot_managed: bool

View File

@ -742,7 +742,6 @@ class RPC:
"est_stake_bot": est_stake_bot if is_bot_managed else 0, "est_stake_bot": est_stake_bot if is_bot_managed else 0,
"stake": stake_currency, "stake": stake_currency,
"side": "long", "side": "long",
"leverage": 1,
"position": 0, "position": 0,
"is_bot_managed": is_bot_managed, "is_bot_managed": is_bot_managed,
"is_position": False, "is_position": False,
@ -764,7 +763,6 @@ class RPC:
"est_stake": position.collateral, "est_stake": position.collateral,
"est_stake_bot": position.collateral, "est_stake_bot": position.collateral,
"stake": stake_currency, "stake": stake_currency,
"leverage": position.leverage,
"side": position.side, "side": position.side,
"is_bot_managed": True, "is_bot_managed": True,
"is_position": True, "is_position": True,

View File

@ -1133,7 +1133,6 @@ class Telegram(RPCHandler):
curr_output = ( curr_output = (
f"*{curr['currency']}:*\n" f"*{curr['currency']}:*\n"
f"\t`{curr['side']}: {curr['position']:.8f}`\n" f"\t`{curr['side']}: {curr['position']:.8f}`\n"
f"\t`Leverage: {curr['leverage']:.1f}`\n"
f"\t`Est. {curr['stake']}: " f"\t`Est. {curr['stake']}: "
f"{fmt_coin(curr['est_stake'], curr['stake'], False)}`\n" f"{fmt_coin(curr['est_stake'], curr['stake'], False)}`\n"
) )

View File

@ -29,7 +29,7 @@ class Wallet(NamedTuple):
class PositionWallet(NamedTuple): class PositionWallet(NamedTuple):
symbol: str symbol: str
position: float = 0 position: float = 0
leverage: float = 0 leverage: Optional[float] = 0 # Don't use this - it's not guaranteed to be set
collateral: float = 0 collateral: float = 0
side: str = "long" side: str = "long"
@ -157,7 +157,7 @@ class Wallets:
continue continue
size = self._exchange._contracts_to_amount(symbol, position["contracts"]) size = self._exchange._contracts_to_amount(symbol, position["contracts"])
collateral = safe_value_fallback(position, "collateral", "initialMargin", 0.0) collateral = safe_value_fallback(position, "collateral", "initialMargin", 0.0)
leverage = position["leverage"] leverage = position.get("leverage")
_parsed_positions[symbol] = PositionWallet( _parsed_positions[symbol] = PositionWallet(
symbol, symbol,
position=size, position=size,