コード例 #1
0
        public async Task <ActionResult <Order> > PutDown(Guid orderId)
        {
            // TODO: Ensure user has Trader role
            // TODO: Validate that the user requesting the put down is the user who picked it up.
            var command = new PutDownOrderCommand(orderId);
            await _queueClient.Send(_configuration.CommandQueueName, command);

            return(Ok());
        }
コード例 #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();
        }