Пример #1
0
        public void TestShortBidOffer()
        {
            symbol = Factory.Symbol.LookupSymbol("EUR/USD");
            var inventory = new InventoryGroupDefault(symbol);

            inventory.Retrace        = .60;
            inventory.RoundLotSize   = 1000;
            inventory.MaximumLotSize = 1000;
            inventory.MinimumLotSize = 1000;
            inventory.Goal           = 5000;
            //Console.WriteLine("Price,Quantity,Cumulative,BreakEven,PandL");
            var first = true;
            var sb    = new StringBuilder();
            var price = 1.7000D;

            for (var i = 0; i < 3000; i++)
            {
                var amountToOffer = 0;
                inventory.CalculateBidOffer(price, price);
                amountToOffer = inventory.OfferSize;
                inventory.Change(price, -amountToOffer);
                var pandl = inventory.CurrentProfitLoss(price);
                sb.AppendLine(Round(price) + "," + amountToOffer + "," + inventory.Size + "," + Round(inventory.BreakEven) + "," + Round(pandl));
                price += symbol.MinimumTick * 10;
            }
            //Console.Write(sb.ToString());
        }
Пример #2
0
        public void TestLongBidOffer()
        {
            symbol = Factory.Symbol.LookupSymbol("EUR/USD");
            var inventory = new InventoryGroupDefault(symbol);

            inventory.Retrace        = .60;
            inventory.RoundLotSize   = 1000;
            inventory.MaximumLotSize = 1000;
            inventory.MinimumLotSize = 1000;
            inventory.Goal           = 5000;
            //Console.WriteLine("Price,Quantity,Cumulative,BreakEven,PandL");
            var first = true;
            var sb    = new StringBuilder();

            for (var price = 1.7000D; price > 1.4000; price -= 10 * symbol.MinimumTick)
            {
                var amountToBid = 0;
                inventory.CalculateBidOffer(price, price);
                amountToBid = inventory.BidSize;
                inventory.Change(price, amountToBid);
                var pandl = inventory.CurrentProfitLoss(price);
                sb.AppendLine(Round(price) + "," + amountToBid + "," + inventory.Size + "," + Round(inventory.BreakEven) + "," + Round(pandl));
            }
        }