Problems using Me.GetMyOrders

TimOtto

Member
Hello,

I am trying to get all my active orders. I think i am calling the right functions, but the function Me:GetMyOrders[Orders] is always returns null and the script is exiting without getting any orders.

I am happy for any information you can give me.

Thanks

Code:
function myOrders()
    {
        variable int i = 1
        variable index:myorder Orders
        variable int OrdersCount
                
        echo "Updating/Fetching My Orders..."
        Me:UpdateMyOrders
        wait 10
                
        Me:GetMyOrders[Orders]                
        while ${Orders} == NULL && ${i:Inc} <= 10
        {
            wait 10
            Me:GetMyOrders[Orders]
        }
        
        echo "orders: ${Orders} i=${i}"
        
        if ${i} >= 10
        {
            echo TIMEOUT
            return null
        }
        
        Orders:GetIterator[it]
        if ${it:First(exists)}
        {
            
            do
            { 
                if (${it.Value.IsSellOrder})
                {
                    echo === SELL Order ===
                }
                elseif (${it.Value.IsBuyOrder})
                {
                    echo === BUY Order ===
                }
                echo ID: ${it.Value.ID}
            }
            while ${it:Next(exists)}
        }
                
        echo "Script finished."
        return Orders
    }
 

CyberTech

Rest in Peace
Staff member
Hello,

I am trying to get all my active orders. I think i am calling the right functions, but the function Me:GetMyOrders[Orders] is always returns null and the script is exiting without getting any orders.

I am happy for any information you can give me.

Thanks
Please read the changelog.

Code:
          NOTE: Returns NULL while the orders are being retrieved, call in a loop with a delay between calls.
          Example:
           Me:UpdateMyOrders
           while !${Me:GetMyOrders[OrderIndex]}
           {
               wait 10
           }
           echo Found ${OrderIndex.Used} orders
 
Top Bottom