Begin implementing OANDA
This commit is contained in:
@@ -39,7 +39,7 @@ class AccountInfo(LoginRequiredMixin, View):
|
||||
}
|
||||
return render(request, template_name, context)
|
||||
|
||||
live_info = dict(account.client.get_account())
|
||||
live_info = dict(account.rawclient.get_account())
|
||||
account_info = account.__dict__
|
||||
account_info = {
|
||||
k: v for k, v in account_info.items() if k in self.VIEWABLE_FIELDS_MODEL
|
||||
|
||||
@@ -20,17 +20,7 @@ def get_positions(user, account_id=None):
|
||||
positions = account.client.get_all_positions()
|
||||
|
||||
for item in positions:
|
||||
item = dict(item)
|
||||
item["account_id"] = account.id
|
||||
item["unrealized_pl"] = float(item["unrealized_pl"])
|
||||
items.append(item)
|
||||
# try:
|
||||
# parsed = ccxt_s.CCXTRoot.from_dict(order)
|
||||
# except ValidationError as e:
|
||||
# log.error(f"Error creating trade: {e}")
|
||||
# return False
|
||||
# self.status = parsed.status
|
||||
# self.response = order
|
||||
return items
|
||||
|
||||
|
||||
@@ -77,7 +67,7 @@ class PositionAction(LoginRequiredMixin, View):
|
||||
unique = str(uuid.uuid4())[:8]
|
||||
|
||||
account = Account.get_by_id(account_id, request.user)
|
||||
success, info = trades.get_position_info(account, asset_id)
|
||||
success, info = account.client.get_position_info(asset_id)
|
||||
if not success:
|
||||
message = "Position does not exist"
|
||||
message_class = "danger"
|
||||
|
||||
Reference in New Issue
Block a user