Fix off by one issue in OANDA

This commit is contained in:
2022-11-29 07:20:39 +00:00
parent f240c4b381
commit f7242f4dd8
4 changed files with 6 additions and 4 deletions

View File

@@ -39,6 +39,9 @@ class TradeAction(LoginRequiredMixin, OTPRequiredMixin, View):
return HttpResponseBadRequest("Trade not found.")
if db_info.order_id is not None:
try:
if db_info.order_id == db_info.response["id"]:
db_info.order_id = str(int(db_info.order_id) + 1)
db_info.save()
live_info = db_info.account.client.get_trade(db_info.order_id)
except GenericAPIError as e:
live_info = {"error": e}