Implement more validation and conversion

This commit is contained in:
2022-11-04 07:20:14 +00:00
parent d34ac39d68
commit 60979652d9
8 changed files with 294 additions and 158 deletions

View File

@@ -14,7 +14,13 @@ log = logs.get_logger(__name__)
class AccountInfo(LoginRequiredMixin, View):
VIEWABLE_FIELDS_MODEL = ["name", "exchange", "api_key", "sandbox"]
VIEWABLE_FIELDS_MODEL = [
"name",
"exchange",
"api_key",
"sandbox",
"supported_symbols",
]
allowed_types = ["modal", "widget", "window", "page"]
window_content = "window-content/account-info.html"
@@ -45,6 +51,7 @@ class AccountInfo(LoginRequiredMixin, View):
account_info = {
k: v for k, v in account_info.items() if k in self.VIEWABLE_FIELDS_MODEL
}
account_info["supported_symbols"] = ", ".join(account_info["supported_symbols"])
if type == "page":
type = "modal"

View File

@@ -36,7 +36,6 @@ class Positions(LoginRequiredMixin, View):
template_name = f"wm/{type}.html"
unique = str(uuid.uuid4())[:8]
items = get_positions(request.user, account_id)
print("ITEMS", items)
if type == "page":
type = "modal"
context = {
@@ -68,7 +67,6 @@ class PositionAction(LoginRequiredMixin, View):
account = Account.get_by_id(account_id, request.user)
info = account.client.get_position_info(symbol)
print("ACCT INFO", info)
if type == "page":
type = "modal"