1. TimOtto

    TimOtto Member

    Messages:
    1
    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 (Text):
    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
        }
     
  2. CyberTech

    CyberTech Second-in-Command Staff Member

    Messages:
    376
    Please read the changelog.

    Code (Text):

              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
     
  3. Ridain

    Ridain Member

    Messages:
    11
    just pm me in irc instead
    Last edited: Mar 23, 2012

Share This Page