Skip to content

Commit

Permalink
fix model problem
Browse files Browse the repository at this point in the history
  • Loading branch information
xkommando committed Jan 29, 2020
1 parent 8b19f6e commit 3bba3bd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions binance_f/model/accountinformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self):
self.openOrderInitialMargin = 0.0
self.positionInitialMargin = 0.0
self.symbol = ""
self.leverage = 0.0
self.unrealizedProfit = 0.0
self.isolated = False

Expand All @@ -41,6 +42,7 @@ def json_parse(json_data):
result = Position()
result.initialMargin = json_data.get_float("initialMargin")
result.maintMargin = json_data.get_float("maintMargin")
result.leverage = json_data.get_float("leverage")
result.openOrderInitialMargin = json_data.get_float("openOrderInitialMargin")
result.positionInitialMargin = json_data.get_float("positionInitialMargin")
result.symbol = json_data.get_string("symbol")
Expand Down
2 changes: 2 additions & 0 deletions binance_f/model/balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ class Balance:

def __init__(self):
self.asset = ""
self.accountAlias = ""
self.balance = 0.0
self.withdrawAvailable = 0.0

@staticmethod
def json_parse(json_data):
result = Balance()
result.asset = json_data.get_string("asset")
result.accountAlias = json_data.get_string("accountAlias")
result.balance = json_data.get_float("balance")
result.withdrawAvailable = json_data.get_float("withdrawAvailable")

Expand Down
2 changes: 1 addition & 1 deletion binance_f/model/mytrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def json_parse(json_data):
result.commission = json_data.get_float("commission")
result.commissionAsset = json_data.get_string("commissionAsset")
result.counterPartyId = json_data.get_int_or_default("counterPartyId", None)
result.orderId = json_data.get_int("orderId")
result.id = json_data.get_int("id")
result.isMaker = json_data.get_boolean("maker")
result.orderId = json_data.get_int("orderId")
result.price = json_data.get_float("price")
Expand Down
2 changes: 2 additions & 0 deletions binance_f/model/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class Position:

def __init__(self):
self.entryPrice = 0.0
self.isAutoAddMargin = False
self.leverage = 0.0
self.maxNotionalValue = 0.0
self.liquidationPrice = 0.0
Expand All @@ -16,6 +17,7 @@ def __init__(self):
def json_parse(json_data):
result = Position()
result.entryPrice = json_data.get_float("entryPrice")
result.isAutoAddMargin = json_data.get_boolean("isAutoAddMargin")
result.leverage = json_data.get_float("leverage")
result.maxNotionalValue = json_data.get_float("maxNotionalValue")
result.liquidationPrice = json_data.get_float("liquidationPrice")
Expand Down

0 comments on commit 3bba3bd

Please sign in to comment.