Пример #1
0
        private static LimitOrder SynthLimitOrder(LimitOrder left, LimitOrder middle, LimitOrder right)
        {
            var newPrice = left.Price * middle.Price * right.Price;

            var middleVolumeInBaseAsset = middle.Volume / left.Price;

            var interimBidPrice        = left.Price * middle.Price;
            var rightVolumeInBaseAsset = right.Volume / interimBidPrice;

            var minVolume = Math.Min(Math.Min(left.Volume, middleVolumeInBaseAsset), rightVolumeInBaseAsset);

            var result = new LimitOrder(newPrice, minVolume);

            return(result);
        }
Пример #2
0
        private static WhichOrder[] GetWithMinVolumeInBaseAsset(LimitOrder left, LimitOrder right)
        {
            var rightVolumeInBaseAsset = right.Volume / left.Price;
            var minVolume = Math.Min(left.Volume, rightVolumeInBaseAsset);

            var result = new List <WhichOrder>();

            if (left.Volume == minVolume)
            {
                result.Add(WhichOrder.Left);
            }

            if (rightVolumeInBaseAsset == minVolume)
            {
                result.Add(WhichOrder.Right);
            }

            return(result.ToArray());
        }