diff --git a/core/exchanges/__init__.py b/core/exchanges/__init__.py index dd44355..fdf187b 100644 --- a/core/exchanges/__init__.py +++ b/core/exchanges/__init__.py @@ -202,3 +202,6 @@ class BaseExchange(object): def get_all_positions(self): raise NotImplementedError + + def close_all_positions(self): + raise NotImplementedError diff --git a/core/exchanges/oanda.py b/core/exchanges/oanda.py index f9fe40a..2a92097 100644 --- a/core/exchanges/oanda.py +++ b/core/exchanges/oanda.py @@ -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 diff --git a/core/templates/index.html b/core/templates/index.html index b7b1baf..e3d8c52 100644 --- a/core/templates/index.html +++ b/core/templates/index.html @@ -4,7 +4,20 @@ {% block outer_content %}