|
|
|
@ -89,9 +89,15 @@ 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]
|
|
|
|
|
# AUCAD 3M Stoch Exit: C$2419.64 at OANDA
|
|
|
|
|
# >>> a.split(":")[0:]
|
|
|
|
|
# ['AUCAD 3M Stoch Exit', ' C$2419.64 at OANDA']
|
|
|
|
|
# >>> a.split(":")[0].split(" ")[2:]
|
|
|
|
|
# ['Stoch', 'Exit']
|
|
|
|
|
# >>> " ".join(a.split(":")[0].split(" ")[2:])
|
|
|
|
|
# 'Stoch Exit'
|
|
|
|
|
|
|
|
|
|
signal_name = " ".join(hook_resp.message.split(":")[0].split(" ")[2:])
|
|
|
|
|
try:
|
|
|
|
|
signal = Signal.objects.get(signal=signal_name)
|
|
|
|
|
except Signal.DoesNotExist:
|
|
|
|
|