コード例 #1
0
 public CreateOrderCommand(
     Guid deskId,
     Guid orderId,
     Guid?parentOrderId,
     Guid instrumentId,
     Guid ownerId,
     decimal quantity,
     Side side,
     OrderType orderType,
     decimal limitPrice,
     string currencyCode,
     MarkupUnit markupUnit,
     decimal markupValue,
     DateTimeOffset?goodTillDate,
     TimeInForce timeInForce)
 {
     DeskId        = deskId;
     OrderId       = orderId;
     ParentOrderId = parentOrderId;
     InstrumentId  = instrumentId;
     OwnerId       = ownerId;
     Quantity      = quantity;
     Side          = side;
     OrderType     = orderType;
     LimitPrice    = limitPrice;
     CurrencyCode  = currencyCode;
     MarkupUnit    = markupUnit;
     MarkupValue   = markupValue;
     GoodTillDate  = goodTillDate;
     TimeInForce   = timeInForce;
 }
コード例 #2
0
        private async Task SeedOrder(Guid instrumentId, string currency, decimal quantity, decimal limitPrice,
                                     decimal markupValue, Guid orderId, Guid deskId, Guid ownerId,
                                     MarkupUnit markupUnit, OrderType orderType, DateTimeOffset?expiration, TimeInForce timeInForce)
        {
            var side = new Random().Next() % 2 == 0 ? Side.Buy : Side.Sell;
            var createOrderCommand = new CreateOrderCommand(
                deskId, orderId, null, instrumentId, ownerId, quantity, side, orderType, limitPrice, currency,
                markupUnit, markupValue, expiration, timeInForce);

            var orderServiceCqc = cqcs.First(x => x.Key == "order-service");
            var rfqServiceCqc   = cqcs.First(x => x.Key == "rfq-service");

            await DispatchCommand(createOrderCommand, orderServiceCqc);

            System.Console.WriteLine($"Sent CreateOrderCommand, OrderId=[{orderId}]");
            System.Console.ReadKey();

            var pickupOrderCommand = new PickupOrderCommand(orderId, Guid.NewGuid());

            await DispatchCommand(pickupOrderCommand, orderServiceCqc);

            System.Console.WriteLine($"Sent PickupOrderCommand (1), OrderId=[{orderId}]");
            System.Console.ReadKey();

            var putdownOrderCommand = new PutDownOrderCommand(orderId);

            await DispatchCommand(putdownOrderCommand, orderServiceCqc);

            System.Console.WriteLine($"Sent PutDownOrderCommand, OrderId=[{orderId}]");
            System.Console.ReadKey();

            var pickupOrderCommand2 = new PickupOrderCommand(orderId, Guid.NewGuid());

            await DispatchCommand(pickupOrderCommand2, orderServiceCqc);

            System.Console.WriteLine($"Sent PickupOrderCommand (2), OrderId=[{orderId}]");
            System.Console.ReadKey();

            List <string> counterParties = new List <string>()
            {
                "Barclays", "ABN Amro", "DNB", "Nordea", "VR-Bank", "Deutche Bank", "RBS"
            };

            var rfqCommand = new RaiseRFQCommand(Guid.NewGuid(), orderId, instrumentId, DateTimeOffset.UtcNow, counterParties);

            await DispatchCommand(rfqCommand, rfqServiceCqc);

            //await Fill(orderId, createOrderCommand);

            //var completeOrderCommand = new CompleteOrderCommand() { OrderId = orderId };

            //await DispatchCommand(completeOrderCommand);
            //System.Console.WriteLine($"Sent CompleteOrderCommand, OrderId=[{orderId}]");
            System.Console.ReadKey();
        }