Exemplo n.º 1
0
        /// <summary>
        /// Reregister the order.
        /// </summary>
        /// <param name="provider">The transactional provider.</param>
        /// <param name="oldOrder">Changing order.</param>
        /// <param name="price">Price of the new order.</param>
        /// <param name="volume">Volume of the new order.</param>
        /// <returns>New order.</returns>
        public static Order ReRegisterOrder(this ITransactionProvider provider, Order oldOrder, decimal price, decimal volume)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            var newOrder = oldOrder.ReRegisterClone(price, volume);

            provider.ReRegisterOrder(oldOrder, newOrder);
            return(newOrder);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reregister the order.
        /// </summary>
        /// <param name="provider">The transactional provider.</param>
        /// <param name="order">Order.</param>
        /// <param name="clone">Changes.</param>
        public static void ReRegisterOrderEx(this ITransactionProvider provider, Order order, Order clone)
        {
            if (provider is null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            if (provider.IsOrderReplaceable(order) == true)
            {
                if (provider.IsOrderEditable(order) == true)
                {
                    provider.EditOrder(order, clone);
                }
                else
                {
                    provider.ReRegisterOrder(order, clone);
                }
            }
            else
            {
                provider.CancelOrder(order);
                provider.RegisterOrder(clone);
            }
        }