Beispiel #1
0
        private void ExecuteProperQuantity(ApiOrder marketOrder)
        {
            var executedQuantity = Math.Min(marketOrder.Quantity, this.SellQuantity);

            this.SellQuantity -= executedQuantity;

            this.RaiseMarketDataUpdated(this.SellPrice, this.SellQuantity);
            this.RaiseOrderExecuted(marketOrder, executedQuantity);
        }
Beispiel #2
0
        private void RaiseOrderExecuted(ApiOrder order, int executedQuantity)
        {
            var onOrderExecuted = this.OrderExecuted;

            if (onOrderExecuted != null)
            {
                onOrderExecuted(order, new ApiDealExecutedEventArgs(this.SellPrice, executedQuantity));
            }
        }
Beispiel #3
0
        private void RaiseOrderFailed(ApiOrder order, ApiOrderFailedEventArgs args)
        {
            var onOrderFailed = this.OrderFailed;

            if (onOrderFailed != null)
            {
                onOrderFailed(order, args);
            }
        }
Beispiel #4
0
 private bool PredicateFailed(ApiOrder marketOrder)
 {
     return(this.OrderPredicate != null && this.OrderPredicate(marketOrder) == false);
 }
Beispiel #5
0
 private bool AskMoreThanAvailableQuantityAndDontSupportPartialExecution(ApiOrder limitOrder)
 {
     return((limitOrder.Quantity > this.SellQuantity) && (!limitOrder.AllowPartialExecution));
 }