Пример #1
0
        public void IfBelowMinimumStakeThenToBelowMinimumReplaceInstructionShouldBeSet(double size, double price)
        {
            var order    = new LimitOrder(12345, Side.Lay, price, size);
            var expected = $"{{\"betId\":\"{order.BetId}\",\"newPrice\":{price}}}";

            Assert.Equal(expected, order.ToBelowMinimumReplaceInstruction());
        }
Пример #2
0
        public void IfAboveMinimumStakeToBelowMinimumInstructionsShouldBeNull(double size, double price)
        {
            var order = new LimitOrder(12345, Side.Lay, price, size);

            Assert.Null(order.ToBelowMinimumCancelInstruction());
            Assert.Null(order.ToBelowMinimumReplaceInstruction());
        }
Пример #3
0
        public async Task OnlyBelowMinimumLimitOrdersAreReplacedWhenMixedWithAboveMinimumOrders(string marketId, long selectionId, Side side, double size, double price)
        {
            var limitOrder    = new LimitOrder(selectionId, side, price, size);
            var aboveMinOrder = new LimitOrder(1, Side.Back, 2, 10);
            await _orderService.Place(marketId, new List <LimitOrder> {
                limitOrder, aboveMinOrder
            });

            var cancelInstruction  = $"{{\"marketId\":\"{marketId}\",\"instructions\":[{limitOrder.ToBelowMinimumCancelInstruction()}]}}";
            var replaceInstruction = $"{{\"marketId\":\"{marketId}\",\"instructions\":[{limitOrder.ToBelowMinimumReplaceInstruction()}]}}";

            Assert.Equal(cancelInstruction, _exchange.SentParameters["cancelOrders"]);
            Assert.Equal(replaceInstruction, _exchange.SentParameters["replaceOrders"]);
        }
Пример #4
0
        public async Task BelowMinimumLimitOrdersArePlacedWithReference(string marketId, long selectionId, Side side, double size, double price, string reference)
        {
            var limitOrder = new LimitOrder(selectionId, side, price, size);
            await _orderService.Place(marketId, new List <LimitOrder> {
                limitOrder
            }, reference);

            var placeInstruction   = $"{{\"marketId\":\"{marketId}\",\"customerStrategyRef\":\"{reference}\",\"instructions\":[{limitOrder.ToInstruction()}]}}";
            var cancelInstruction  = $"{{\"marketId\":\"{marketId}\",\"instructions\":[{limitOrder.ToBelowMinimumCancelInstruction()}]}}";
            var replaceInstruction = $"{{\"marketId\":\"{marketId}\",\"customerStrategyRef\":\"{reference}\",\"instructions\":[{limitOrder.ToBelowMinimumReplaceInstruction()}]}}";

            Assert.Equal(placeInstruction, _exchange.SentParameters["placeOrders"]);
            Assert.Equal(cancelInstruction, _exchange.SentParameters["cancelOrders"]);
            Assert.Equal(replaceInstruction, _exchange.SentParameters["replaceOrders"]);
        }