As in the trading terminal Sterling get a list of orders?

Discussion in 'App Development' started by Yuriy, Sep 4, 2014.

  1. Yuriy

    Yuriy

    Method in the trading terminal Sterling
    Code:
    GetOrderList(VARIANT_BOOL bOpenOnly, SAFEARRAY(structSTIOrderUpdate) *arrayOrder, long *lCount);
    Such a structure it in Visual Studio
    Code:
    int GetOrderList([In] bool bOpenOnly, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_EMPTY), In, Out] ref Array arrayOrder);
    Trying to call it in my application, but I can not understand what I have to do everything to work correctly.
    code:

    Code:
                 Array arrList = new Array[10];
                    var d = stiOrderMaint.GetOrderList(false, ref arrList);
    Throws an error type of the array is not as expected, try a different
    The programming language C #.
    Please help me, how do I call this method. Thank you.
     
  2. ellevers

    ellevers

    Code:
    public int OrderCount = new int();
    public Array OrderList;
    public SterlingLib.structSTIOrderUpdate q;
    public string id;
    
    OrderList = Array.CreateInstance((typeof(SterlingLib.structSTIOrderUpdate)), 0);
    
    OrderCount = Omaint.GetOptionsOrderList(false, ref OrderList);
    
    q = new structSTIOrderUpdate();
    
    for (int i = 0; i < OrderCount; i++)
                    {
    q = (SterlingLib.structSTIOrderUpdate)OrderList.GetValue(i);
    
    id = q.bstrUserId.ToString();
    }
    Hope this helps
     
  3. ellevers

    ellevers

    Code:
    public STIEvents events;
    
    events = new STIEvents();
    
    events.SetOrderEventsAsStructs(true);
    Forgot that part.
     
  4. Yuriy

    Yuriy

    Omaint = new STIOrderMaint(); ?

    OrderCount = stiOrderMaint.GetOrderList(false, ref OrderList1); - here the error takes.
     
  5. ellevers

    ellevers

    Code:
    public STIOrderMaint Omaint;
     
  6. Yuriy

    Yuriy

    Thank you :)