Remove asset filter and begin implementing posting trades

This commit is contained in:
2022-11-10 07:20:14 +00:00
parent 47384aed5f
commit 40f6330a13
7 changed files with 164 additions and 86 deletions

View File

@@ -1,7 +1,6 @@
import re
import orjson
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponse, HttpResponseBadRequest
from pydantic import ValidationError
@@ -56,9 +55,6 @@ class HookAPI(APIView):
base = hook_resp.market.item
quote = hook_resp.market.currency
symbol = f"{base.upper()}/{quote.upper()}"
if symbol not in settings.ASSET_FILTER:
log.debug(f"Skipping {symbol} because it is not in the asset filter")
return HttpResponseBadRequest("Invalid symbol")
data = {
"title": hook_resp.title,

View File

@@ -6,6 +6,7 @@ from django.shortcuts import render
from django.views import View
from rest_framework.parsers import FormParser
from core.exchanges import GenericAPIError
from core.models import Account
from core.util import logs
@@ -16,7 +17,10 @@ def get_positions(user, account_id=None):
items = []
accounts = Account.objects.filter(user=user)
for account in accounts:
positions = account.client.get_all_positions()
try:
positions = account.client.get_all_positions()
except GenericAPIError:
continue
for item in positions:
items.append(item)