Add controls boilerplate to main page

This commit is contained in:
2022-11-14 18:29:07 +00:00
parent d2e0137c8d
commit 2aac7d1bb5
7 changed files with 405 additions and 4 deletions

View File

@@ -202,3 +202,6 @@ class BaseExchange(object):
def get_all_positions(self):
raise NotImplementedError
def close_all_positions(self):
raise NotImplementedError

View File

@@ -105,3 +105,13 @@ class OANDAExchange(BaseExchange):
item["unrealized_pl"] = float(item["unrealized_pl"])
items.append(item)
return items
def close_all_positions(self):
# all_positions = self.get_all_positions()
# for position in all_positions["itemlist"]:
# print("POS ITER", position)
r = positions.PositionClose(accountID=self.account_id)
response = self.call(r)
print("CLOSE ALL POSITIONS", response)
return response