Hi, ORDER.GetExchangeCount() returns a full count of destinations for me but OPTIONORDER.GetExchangeCount() does not. NOTE: I can see the destinations for options orders in the UI. The actual return value of these functions is Empty for ORDER and False for OPTIONORDER. Permissions issue? Thanks
Hi @DDALY ,
Have you checked out the sample code in this sheet? Here, you're setting the order object with the symbol, type, date, etc for the option order, then retrieving the values.
Here, I return a value of 201 (on my test ID).
Sub LoadDestList() Dim I As Integer Dim NamedRng As String Dim cnt As Variant Dim Dest As Variant Dim DestTemp As Variant Dim RetVal As Variant Dim RetVal2 As Variant Dim RNGSort As String Dim obj As Object Dim FindDest As String Dim COL As Long Dim RNGCut As String Dim MSG As String Dim exch As Variant Dim objRegExp As New RegExp Dim strPattern As String: strPattern = "[ ][A-Z]" Dim regEx As New RegExp Dim Myrange As Range Dim inputMatches As Object Dim Count As Integer: Count = 0 Dim hOrder As New OPTIONORDER hOrder.symbol = UCase(Worksheets("REDIOptionOrderEntry").Cells(2, "C").Value) hOrder.Type = Worksheets("REDIOptionOrderEntry").Cells(3, "C").Value hOrder.Date = Worksheets("REDIOptionOrderEntry").Cells(4, "C").Value hOrder.Strike = Worksheets("REDIOptionOrderEntry").Cells(5, "C").Value RetVal = hOrder.GetExchangeCount(cnt) Worksheets("REDISettings").Range("D3:D1000").Clear Worksheets("REDISettings").Range("D3:D1000").Interior.Color = RGB(242, 242, 242) For I = 0 To cnt - 1 exch = hOrder.GetExchangeAt(I) 'Debug.Print exch & " " & I With regEx .Global = True .MultiLine = True .IgnoreCase = False .Pattern = strPattern End With If regEx.Test(exch) Then Set inputMatches = regEx.Execute(exch) 'Debug.Print exch & " " & inputMatches.Count If inputMatches.Count = 1 Then Worksheets("REDISettings").Cells(Count + 3, "D").Interior.Color = RGB(255, 255, 255) Worksheets("REDISettings").Cells(Count + 3, "D").Borders.Color = RGB(234, 234, 234) Worksheets("REDISettings").Cells(Count + 3, "D").Value = exch Count = Count + 1 End If End If Next I Worksheets("REDISettings").Range("D3:D" & Count + 2).Sort Key1:=Worksheets("REDISettings").Range("D3:D" & Count + 2), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal NamedRng = "=REDISettings!R3C4:R" & Count + 2 & "C4" Names.Add Name:="Destinations", RefersToR1C1:=NamedRng End Sub
Hi @brian.mullane, I'm having a problem with data for one of our production users. The destination he uses on the UI is "IBCO DMA" as per screenshot.
However if I try to get destinations in code (below) using the same order details, I only get "IBO2 DMA". Any ideas?
Sub GetOptionDest() Dim hOrder As New OPTIONORDER Dim RetVal, I, cnt, exch hOrder.Symbol = "VICI" hOrder.Type = "Put" hOrder.Date = "Jan '23" hOrder.Strike = 30 RetVal = hOrder.GetExchangeCount(cnt) For I = 0 To cnt - 1 exch = hOrder.GetExchangeAt(I) Cells(I + 2, 5).Value = exch Next I End Sub
Hi @zoya faberov, No unfortunately that didn't help. Also I get the same problem listing the destination for equity orders. If I set up the basic order details in the ORDER object and retrieve the exchanges I can't see "IBCO DMA" which is what the user selects for equity orders via the UI. Please let me know if you have any other ideas, otherwise I might just set up the desired destinations in the application config. Thanks!
[Also I saw you comment - NOTED - in future I'll create a new question]
Hi @DDALY ,
I think I understand what is going on. At first I thought the user was not able to populate the destinations correctly, so I have approached from that assumption.
Please refer to REDI Destination Name Mappings doc.
"IBCO DMA" is "IBO2 DMA", per programmatic interface.
I was wondering how I can stop making the Bid, ASK and Last field automatically populate from the REDI API in my order entry tool in excel, it might be coded into the VBA somewhere in the sheet, i am not sure how to fix it
I am sending and canceling orders via excel VBA and Redi on 150 stocks. Redi crashes after a certain period of time, I will often get this response "Microsoft Excel is waiting for another application to complete an OLE action."