Implement TP/SL price to percent conversion

This commit is contained in:
2023-01-05 19:27:59 +00:00
parent a6f9e74ee1
commit d3e2bc8648
6 changed files with 389 additions and 23 deletions

View File

@@ -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,
}
],
),