question

Upvotes
Accepted
191 4 8 15

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


redi-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
32.2k 40 11 20

Hello @DDALY ,

Try to remove

Ord.AddOptionLeg

Appears to be causing the same misreport, for me - hope this helps

---

When order population requirements for ComplexOrders in REDI turn a bit tricky, I find it helpful to go back to REDI VB ExcelExamples on GitHub -> Example "Order Entry - Complex Option", start with the working example for a specific option type, and work to the current requirement.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
191 4 8 15

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



capture.jpg (16.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @DDALY ,

So let us try see what is different about staging environment?

  • Is version of REDIPlus different?
  • Are you logging in as a different user, perhaps permissioned differently?

(if you hit "?" and "About REDIPlus" from the desktop, you will see this information)

Any other differences that you can think of?

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.



version-staging.jpg (32.6 KiB)
version-prod.jpg (31.8 KiB)
Hello @DDALY ,

Versions are very different.

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

Show more comments
Upvotes
32.2k 40 11 20

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
191 4 8 15
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.