Implement TP/SL price to percent conversion
This commit is contained in:
@@ -86,6 +86,13 @@ def parse_value(x):
|
||||
return 0
|
||||
|
||||
|
||||
def parse_current_units_side(x):
|
||||
if float(x["currentUnits"]) > 0:
|
||||
return "long"
|
||||
elif float(x["currentUnits"]) < 0:
|
||||
return "short"
|
||||
|
||||
|
||||
def parse_side(x):
|
||||
prevent_hedging(x)
|
||||
if float(x["long"]["units"]) > 0:
|
||||
@@ -529,6 +536,7 @@ OpenTradesSchema = {
|
||||
"stopLossOrder": "stopLossOrder",
|
||||
"trailingStopLossOrder": "trailingStopLossOrder",
|
||||
"trailingStopValue": "trailingStopValue",
|
||||
"side": parse_current_units_side,
|
||||
}
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user