From 2aac7d1bb5f10941d67b3d05a3e921b283c4d6e3 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 14 Nov 2022 18:29:07 +0000 Subject: [PATCH] Add controls boilerplate to main page --- core/exchanges/__init__.py | 3 + core/exchanges/oanda.py | 10 + core/templates/index.html | 30 ++- core/templates/window-content/controls.html | 109 +++++++++ core/templates/window-content/main.html | 2 - core/templates/window-content/objects.html | 2 +- core/templates/window-content/offset.html | 253 ++++++++++++++++++++ 7 files changed, 405 insertions(+), 4 deletions(-) create mode 100644 core/templates/window-content/controls.html create mode 100644 core/templates/window-content/offset.html 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 %}
-
+
+
+ +
+
+
+ +
+
+ +
+
+