Example #1
0
        // TODO Should we be averaging out matches across price levels?
        // TODO How do we sensibly handle matching crossed markets?
        // Should be "initiator" price, so price of older order?
        // Currently orders that would cross the market are rejected

        /// <summary>
        /// Create an order stack with a provided way of sorting the orders
        /// </summary>
        /// <param name="orderMatcher">The class to carry out order matching</param>
        /// <param name="comp">
        /// A way of comparing the orders where less-than means a better order.
        /// The comparer should ensure that it sorts bids and asks appropriately.
        /// </param>
        public OrderStack(IOrderMatcher orderMatcher,
                          IComparer <IOrder> comp)
        {
            _bids         = new SortedSet <IOrder>(comp);
            _asks         = new SortedSet <IOrder>(comp);
            _orderMatcher = orderMatcher;
        }
Example #2
0
 /// <summary>
 /// The class constructor.
 /// </summary>
 /// <param name="matcher"> Instance of OrderMatcher.</param>
 public TradesController(IOrderMatcher matcher)
 {
     _matcher = matcher;
 }
Example #3
0
 /// <summary>
 /// Create an order stack using default order sorting
 /// </summary>
 /// <param name="orderMatcher">The class to carry out order matching</param>
 /// <see cref="OrderSorter.StandardOrderSorter"/>
 public static OrderStack CreateStandardSortedStack(IOrderMatcher orderMatcher)
 {
     return new OrderStack(orderMatcher,
                           new OrderStack.StandardOrderComparer());
 }
 public StandardOrderRepository(IOrderMatcher orderMatcher)
 {
     _orderMatcher = orderMatcher;
 }
Example #5
0
 /// <summary>
 /// Create an order stack using default order sorting
 /// </summary>
 /// <param name="orderMatcher">The class to carry out order matching</param>
 /// <see cref="OrderSorter.StandardOrderSorter"/>
 public static OrderStack CreateStandardSortedStack(IOrderMatcher orderMatcher)
 {
     return(new OrderStack(orderMatcher,
                           new OrderStack.StandardOrderComparer()));
 }
 /// <summary>
 /// The class constructor.
 /// </summary>
 /// <param name="matcher"> Instance of OrderMatcher.</param>
 public OrdersController(IOrderMatcher matcher)
 {
     _matcher = matcher;
 }
 public StandardOrderRepository(IOrderMatcher orderMatcher)
 {
     _orderMatcher = orderMatcher;
 }