Skip to content

Commit 271148a

Browse files
committed
reformat position string and remove instrument restriction
1 parent bf469a0 commit 271148a

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

bitmex.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ def display_positions(secret, id_api):
6161
position_list = get_position_list(secret, id_api)
6262
position_string = ""
6363
for pos in position_list:
64-
position_string += str(pos) + "\n\n"
64+
position_string += (str(pos) + "\n")
6565
return position_string
6666

position.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,4 @@ def set_realised_pnl(self, p):
7777
self.realised_pnl = p
7878

7979
def __str__(self):
80-
if self.symbol.lower() == "xbtusd":
81-
return "Instrument: " + self.symbol + "\n" +"Direction: "+ self.direction +"\n" + "Position Size: " + str(self.position_size) + " Contracts" +"\n" + "Value: " + str(abs(self.position_value / 100000000)) + " XBT" + "\n" + "Entry Price: $" + str(self.entry) + "\n" + "Market Price: $" + str(self.market_price) + "\n" +"Liquidation Price: $" + str(self.liquidation_price) + "\n" + "Margin: " + str(self.margin / 100000000) + " XBT" +"\n" + "Leverage: " + str(self.leverage) +"x" + "\n" + "Unrealised PNL: " + str(format(self.unrealised_pnl / 100000000, 'f')) + " XBT" + "\n" + "Realised PNL: " + str(format(self.realised_pnl / 100000000, 'f')) + " XBT" + "\n"
80+
return "Instrument: " + self.symbol + "\n" +"Direction: "+ self.direction +"\n" + "Position Size: " + str(self.position_size) + " Contracts" +"\n" + "Value: " + str(abs(self.position_value / 100000000)) + " XBT" + "\n" + "Entry Price: $" + str(self.entry) + "\n" + "Market Price: $" + str(self.market_price) + "\n" +"Liquidation Price: $" + str(self.liquidation_price) + "\n" + "Margin: " + str(self.margin / 100000000) + " XBT" +"\n" + "Leverage: " + str(self.leverage) +"x" + "\n" + "Unrealised PNL: " + str(format(self.unrealised_pnl / 100000000, 'f')) + " XBT" + "\n" + "Realised PNL: " + str(format(self.realised_pnl / 100000000, 'f')) + " XBT" + "\n"

0 commit comments

Comments
 (0)