Remove asset filter and begin implementing posting trades
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user