Rename pairs to assets

This commit is contained in:
Mark Veidemanis 2023-02-13 17:50:46 +00:00
parent 0321aff9d5
commit b48af50620
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 13 additions and 13 deletions

View File

@ -28,8 +28,8 @@ log = logs.get_logger(__name__)
class AssetGroupList(LoginRequiredMixin, ObjectList):
list_template = "partials/assetgroup-list.html"
model = AssetGroup
page_title = "List of asset groups for restrictions. Linked to strategies."
page_subtitle = "Asset groups are collections of asset restrictions."
page_title = "List of asset groups for aggregations. Linked to strategies."
page_subtitle = "Asset groups are maps between currencies and their sentiment."
list_url_name = "assetgroups"
list_url_args = ["type"]
@ -165,18 +165,18 @@ class AssetGroupAPI(APIView):
topic = request.data["topic"]
print("YES TOPIC", topic)
new_pairs = []
pair_split = topic.split(",")
if not pair_split:
log.error(f"Asset API {webhook_id} topic {topic} is not a pair")
new_assets = []
assets_split = topic.split(",")
if not assets_split:
log.error(f"Asset API {webhook_id} topic {topic} is not an asset")
return HttpResponse(status=status.HTTP_400_BAD_REQUEST)
for pair in pair_split:
if pair:
new_pairs.append(pair.strip())
for asset in assets_split:
if asset:
new_assets.append(asset.strip())
else:
log.error(f"Asset API {webhook_id} pair {pair} is not a pair")
log.error(f"Asset API {webhook_id} asset {asset} is not an asset")
return HttpResponse(status=status.HTTP_400_BAD_REQUEST)
print("YES PAIRS", new_pairs)
print("YES PAIRS", new_assets)
# Check if we have lower/upper bounds
if group.aggregation != "none":
@ -191,8 +191,8 @@ class AssetGroupAPI(APIView):
)
print("YES AVG IS MATCH", is_match)
for pair in new_pairs:
group.allowed[pair] = is_match is True or None
for asset in new_assets:
group.allowed[asset] = is_match is True or None
group.save()
return HttpResponse(status=status.HTTP_200_OK)