Allow spaces in signal name
This commit is contained in:
parent
3b3faecdf1
commit
6a549f3fd7
|
@ -89,9 +89,15 @@ class HookAPI(APIView):
|
||||||
return HttpResponseBadRequest("Hook does not exist.")
|
return HttpResponseBadRequest("Hook does not exist.")
|
||||||
|
|
||||||
# Try getting the signal
|
# Try getting the signal
|
||||||
# AUCAD 3M StochExit: C$2419.64 at OANDA
|
# AUCAD 3M Stoch Exit: C$2419.64 at OANDA
|
||||||
message_first_half = hook_resp.message.split(":")[0]
|
# >>> a.split(":")[0:]
|
||||||
signal_name = message_first_half.split(" ")[-1]
|
# ['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:
|
try:
|
||||||
signal = Signal.objects.get(signal=signal_name)
|
signal = Signal.objects.get(signal=signal_name)
|
||||||
except Signal.DoesNotExist:
|
except Signal.DoesNotExist:
|
||||||
|
|
Loading…
Reference in New Issue