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