COMPLEXORDER - "Side is Required" Error

In production we're getting a "Side is Required" error from the code below however it works fine in the test environment. Any ideas welcome. Thanks!


Private Function SendOptionsOrder() As Integer
'===============================================================
' Send diagonal options order to REDI.
'===============================================================
    Dim Ord As New COMPLEXORDER
    Dim RediRtn As Variant
    Dim RetVal As Integer: RetVal = RET_OK
    Dim ErrMsg As Variant
    
    ' Complex order header
    Ord.Strategy = "Diagonal"
    Ord.SetSymbol 0, "VICI"
    Ord.SetTIF 0, "Day"
    Ord.SetAccount 0, "ACC1"
    
    ' Long Put
    Ord.SetSide 1, "Buy"
    Ord.SetPosition 1, "Open"
    Ord.SetOptType 1, "Put"
    Ord.SetMonth 1, "Jan '23"
    Ord.SetStrike 1, "30.00"
    
    ' Short Put
    Ord.AddOptionLeg
    Ord.SetSide 2, "Sell"
    Ord.SetPosition 2, "Open"
    Ord.SetOptType 2, "Put"
    Ord.SetMonth 2, "Nov '21"
    Ord.SetStrike 2, "25.00"
    
    ' complete header details
    Ord.CustomerIndicator = "xyz"
    Ord.SetExchange 0, "IBCO DMA"
    Ord.SetQuantity 0, 1
    Ord.SetPriceType 0, "Limit"
    Ord.SetPrice 0, 2
        
    ' send order
    RediRtn = Ord.Submit(ErrMsg)
    
    If Not RediRtn Then
        RetVal = RET_FAIL
        If Trim(ErrMsg) = "" Then
          ErrMsg = "No error message returned. Please contact support."
        End If
        ErrMsg = "Options order FAILED." & vbCrLf & vbCrLf & "Error Message: " & ErrMsg
        MsgBox ErrMsg, vbCritical + vbOKOnly, "Order Entry Failed"
    End If
    SendOptionsOrder = RetVal

End Function


Tagged:

Best Answer

Answers