예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        protected bool CancelOrder(HuobiOrder o)
        {
            bool traded = false;

            try
            {
                HuobiSimpleResult cancelResult = m_huobi.CancelOrder(m_market, o.id);
            }
            catch (HuobiException e)
            {
                // ignore order which have been filled, or cancelled
                if (e.m_error.code != 41 && e.m_error.code != 42)
                {
                    throw;
                }
                else
                {
                    if (e.m_error.code == 41)
                    {
                        // not found, so filled
                        m_renderer.AddMarker(o.type == HuobiOrderType.buy, true, o.order_price, UnixTime.ConvertToDateTime(o.order_time));

                        traded = true;
                    }

                    m_lastOpenOrders.RemoveAll(loo => loo.id == o.id);
                }
            }

            return(traded);
        }