Skip to content

Commit

Permalink
improve func determine_pos_side()
Browse files Browse the repository at this point in the history
  • Loading branch information
enarjord authored Jan 28, 2023
1 parent ad7baa8 commit cfd8bd9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bybit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,33 @@ def first_capitalized(s: str):

def determine_pos_side(o: dict) -> str:
if o["side"].lower() == "buy":
if "reduce_only" in o:
if o["reduce_only"]:
return "short"
else:
return "long"
if "closed_size" in o:
if o["closed_size"] != 0.0:
return "short"
else:
return "long"
if "entry" in o["order_link_id"]:
return "long"
elif "close" in o["order_link_id"]:
return "short"
else:
return "both"
else:
if "reduce_only" in o:
if o["reduce_only"]:
return "long"
else:
return "short"
if "closed_size" in o:
if o["closed_size"] != 0.0:
return "long"
else:
return "short"
if "entry" in o["order_link_id"]:
return "short"
elif "close" in o["order_link_id"]:
Expand Down

0 comments on commit cfd8bd9

Please sign in to comment.