Get the right signal name from the callback and fix position close schema
This commit is contained in:
parent
848f69da5e
commit
077768975d
|
@ -528,20 +528,20 @@ class OrderTransation(BaseModel):
|
|||
type: str
|
||||
instrument: str
|
||||
units: str
|
||||
timeInForce: str
|
||||
positionFill: str
|
||||
timeInForce: str | None
|
||||
positionFill: str | None
|
||||
reason: str
|
||||
longPositionCloseout: LongPositionCloseout
|
||||
longOrderFillTransaction: dict
|
||||
|
||||
|
||||
class PositionClose(BaseModel):
|
||||
longOrderCreateTransaction: OrderTransaction
|
||||
longOrderFillTransaction: OrderTransaction
|
||||
longOrderCancelTransaction: OrderTransaction
|
||||
shortOrderCreateTransaction: OrderTransaction
|
||||
shortOrderFillTransaction: OrderTransaction
|
||||
shortOrderCancelTransaction: OrderTransaction
|
||||
longOrderCreateTransaction: OrderTransaction | None
|
||||
longOrderFillTransaction: OrderTransaction | None
|
||||
longOrderCancelTransaction: OrderTransaction | None
|
||||
shortOrderCreateTransaction: OrderTransaction | None
|
||||
shortOrderFillTransaction: OrderTransaction | None
|
||||
shortOrderCancelTransaction: OrderTransaction | None
|
||||
relatedTransactionIDs: list[str]
|
||||
lastTransactionID: str
|
||||
|
||||
|
|
|
@ -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.")
|
||||
|
||||
|
|
Loading…
Reference in New Issue