Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maintMargin -> initialMargin #57

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions vnpy_binance/binance_linear_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ def on_query_account(self, data: dict, request: Request) -> None:
account: AccountData = AccountData(
accountid=asset["asset"],
balance=float(asset["walletBalance"]),
frozen=float(asset["maintMargin"]),
# https://binance-docs.github.io/apidocs/futures/cn/#v3-user_data-2
frozen=float(asset["initialMargin"]),
gateway_name=self.gateway_name
)

Expand All @@ -517,6 +518,7 @@ def on_query_position(self, data: list, request: Request) -> None:
exchange=Exchange.BINANCE,
direction=Direction.NET,
volume=float(d["positionAmt"]),
frozen=float(d["initialMargin"]), # https://binance-docs.github.io/apidocs/futures/cn/#v3-user_data-3
price=float(d["entryPrice"]),
pnl=float(d["unRealizedProfit"]),
gateway_name=self.gateway_name,
Expand Down Expand Up @@ -769,7 +771,6 @@ def on_packet(self, packet: dict) -> None:
def on_listen_key_expired(self) -> None:
"""Callback of listen key expired"""
self.gateway.write_log("Listen key is expired")
self.disconnect()

def on_account(self, packet: dict) -> None:
"""Callback of account balance and holding position update"""
Expand Down