예제 #1
0
        /// <summary>
        /// Returns a string that represents the current object.
        /// </summary>
        /// <returns>
        /// A string that represents the current object.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override string ToString()
        {
            // create a proxy order object to steal his to string method
            var proxy = Order.CreateOrder(this);

            return(Invariant($"{Time} UTC: Submit Order: ({OrderId}) - {proxy} {Tag} Status: {Status}"));
        }
        /// <summary>
        /// Returns a string that represents the current object.
        /// </summary>
        /// <returns>
        /// A string that represents the current object.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override string ToString()
        {
            // create a proxy order object to steal his to string method
            var proxy = Order.CreateOrder(this);

            return(string.Format("{0} UTC: Submit Order: ({1}) - {2} {3}", Time, OrderId, proxy, Tag) + " Status: " + Status);
        }
예제 #3
0
        /// <summary>
        /// Gets all open orders on the account.
        /// NOTE: The order objects returned do not have QC order IDs.
        /// </summary>
        /// <returns>The open orders returned from IB</returns>
        public override List <Order> GetOpenOrders()
        {
            List <Order> list = new List <Order>();

            Dictionary <string, OrderInfo> orders = _restApi.GetOpenOrders();

            foreach (KeyValuePair <string, OrderInfo> pair in orders)
            {
                OrderInfo info = pair.Value;

                OrderDescription desc = info.Descr;

                // check for debug purposes here
                if (pair.Key != desc.Pair)
                {
                    throw new KrakenException("this doesn't match, please inspect!!");
                }

                var SOR = new SubmitOrderRequest(

                    TranslateOrderTypeToLean(info.Descr.OrderType),
                    SecurityType.Crypto,
                    this.SymbolMapper.GetLeanSymbol(desc.Pair, SecurityType.Crypto, Market.Kraken),
                    info.Volume - info.VolumeExecuted,
                    info.StopPrice.HasValue ? info.StopPrice.Value : 0m,
                    info.LimitPrice.HasValue ? info.LimitPrice.Value : 0m,
                    UnixTimeStampToDateTime(info.OpenTm),
                    ""
                    );

                var order = Order.CreateOrder(SOR);
                list.Add(order);
            }

            return(list);
        }