Get the right signal name from the callback and fix position close schema

This commit is contained in:
2022-12-02 07:20:37 +00:00
parent 848f69da5e
commit 077768975d
2 changed files with 12 additions and 9 deletions

View File

@@ -89,8 +89,11 @@ class HookAPI(APIView):
return HttpResponseBadRequest("Hook does not exist.")
# Try getting the signal
# AUCAD 3M StochExit: C$2419.64 at OANDA
message_first_half = hook_resp.message.split(":")[0]
signal_name = message_first_half.split(" ")[-1]
try:
signal = Signal.objects.get(signal=hook_resp.title)
signal = Signal.objects.get(signal=signal_name)
except Signal.DoesNotExist:
return HttpResponseBadRequest("Signal does not exist.")