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

  • Hi, @zoya faberov, Firstly, that worked so thank you! Also, great advice on the example Excel file - I'll keep that handy for reference.

    The problem however is that now it doesn't work for me in the staging environment [see error message]. I remember this was the reason I added that line of code in the first place. Seems like there is some kind of environmental mismatch. How can we fix this?

    Capture.JPG


  • Hi @zoya faberov, Yes the versions are different [see screenshots].

    version_staging.JPGversion_prod.JPG

    Also the users are different (I don't have a production login). That's about all I could tell you. Thank You.



  • Hello @DDALY ,

    Versions are very different.

    I believe this would explain interface difference, and consequently, the API usage difference.

  • Hi
    @zoya faberov, Can you confirm whether this is a bug or intentional behavior? The version that doesn't work is the later version and it seems unlikely that they would knowingly release an upgrade that would cause the sample API applications to fail, no? Thanks!
  • Hi @DDALY ,

    I will try to obtain more information on this from the product development.

    • In my personal opinion, what we see is a difference in interface, and the later interface, v21, is more efficient, making the extra call unnecessary.
    • As a developer and designer, I would prefer to keep development and production on the same version whenever possible, to avoid any discrepancies between them, due to any causes.
    • As the way to save time, while allowing to deploy your code in prod, as a temporary measure, I could comment out this call just prior to being deployed in prod.

    I will update this question, once we have more information- appreciate your patience.

  • Hello @DDALY and all,

    Please find our Complex Options -> Diagonal sample updated on GitHub, to set Symbol before setting Strategy.

    This example code is verified to work with versions 19 and 21, and by following the same approach, you should be able to have the custom code running under both versions.

    Diagonal example does not include setting AddOptionLeg. It is not intended for use for Diagonal, it should only be used for custom strategy.

    Hope this information helps