fixed breaking tests for liquidation price

This commit is contained in:
Sam Germain
2022-01-13 01:21:36 -06:00
parent 1eee5373b9
commit 2d545a2def
5 changed files with 73 additions and 65 deletions

View File

@@ -139,12 +139,12 @@ class Binance(Exchange):
[amt, old_ratio] = [None, None]
brackets = []
for [notional_floor, mm_ratio] in brkts:
amt = ((float(notional_floor) * (mm_ratio - old_ratio)) +
amt = ((float(notional_floor) * (float(mm_ratio) - float(old_ratio))) +
amt) if old_ratio else 0
old_ratio = mm_ratio
brackets.append([
float(notional_floor),
mm_ratio,
float(mm_ratio),
amt,
])
self._leverage_brackets[pair] = brackets
@@ -231,8 +231,8 @@ class Binance(Exchange):
def get_maintenance_ratio_and_amt(
self,
pair: Optional[str],
nominal_value: Optional[float]
pair: str,
nominal_value: Optional[float] = 0.0,
):
'''
Maintenance amt = Floor of Position Bracket on Level n *

View File

@@ -2005,8 +2005,8 @@ class Exchange:
def get_maintenance_ratio_and_amt(
self,
pair: Optional[str],
nominal_value: Optional[float]
pair: str,
nominal_value: Optional[float] = 0.0,
):
'''
:return: The maintenance amount, and maintenance margin rate

View File

@@ -43,8 +43,8 @@ class Gateio(Exchange):
def get_maintenance_ratio_and_amt(
self,
pair: Optional[str],
nominal_value: Optional[float]
pair: str,
nominal_value: Optional[float] = 0.0,
):
info = self.markets[pair]['info']
if 'maintenance_rate' in info: