|
|
|
@ -21,6 +21,8 @@ def get_positions(user, account_id=None):
|
|
|
|
|
if not success:
|
|
|
|
|
items.append({"name": account.name, "status": "error"})
|
|
|
|
|
continue
|
|
|
|
|
for position in positions:
|
|
|
|
|
position["account"] = account.name
|
|
|
|
|
|
|
|
|
|
for item in positions:
|
|
|
|
|
items.append(item)
|
|
|
|
@ -40,6 +42,7 @@ 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 = {
|
|
|
|
@ -60,7 +63,7 @@ class PositionAction(LoginRequiredMixin, View):
|
|
|
|
|
window_content = "window-content/view-position.html"
|
|
|
|
|
parser_classes = [FormParser]
|
|
|
|
|
|
|
|
|
|
async def get(self, request, type, account_id, asset_id):
|
|
|
|
|
async def get(self, request, type, account_id, symbol):
|
|
|
|
|
"""
|
|
|
|
|
Get live information for a trade.
|
|
|
|
|
"""
|
|
|
|
@ -70,7 +73,8 @@ class PositionAction(LoginRequiredMixin, View):
|
|
|
|
|
unique = str(uuid.uuid4())[:8]
|
|
|
|
|
|
|
|
|
|
account = Account.get_by_id(account_id, request.user)
|
|
|
|
|
success, info = account.client.get_position_info(asset_id)
|
|
|
|
|
success, info = account.client.get_position_info(symbol)
|
|
|
|
|
print("ACCT INFO", info)
|
|
|
|
|
if not success:
|
|
|
|
|
message = "Position does not exist"
|
|
|
|
|
message_class = "danger"
|
|
|
|
|