예제 #1
0
        public void BarAnalyzerBreaksWithData()
        {
            // get the marketId from the market with this symbol
            string marketSymbol = "YM";

            int momentumPeriod = 9;

            Felix.Library.BLL.Market market = new Felix.Library.BLL.Market(marketSymbol);

            List <IBar> bars = BarData.Bars("YMM18", DateTime.Parse("2018-03-27"), DateTime.Parse("2018-03-28"))
                               .ToList();

            List <IBarDatum> barData = bars.ToBarDatum(market.MarketId, momentumPeriod).ToList();

            // subscribe to MoveStream and just write them to the debug
            moveManager.MoveStream
            .SubscribeOn(Scheduler.NewThread)
            .Subscribe(m => OnMove(m), err => ReportError(err));

            foreach (var data in barData)
            {
                moveManager.Insert(data);
            }

            Thread.Sleep(5000);

            Debug.WriteLine($"found {moves.Count} moves");
        }
예제 #2
0
        public void MarketTest()
        {
            var repo = new MarketRepository();

            string expectedName = "DowJones";

            string expectedExchange = "CBOT";

            decimal expectedTickSize = (decimal)5.00;

            string expectedMonths = "Mar, Jun, Sep, Dec";

            var mockContracts = MarketDataMock.Contracts;

            var mockMetaMappings = MarketDataMock.MetaMappings;

            Felix.Library.BLL.Market market = new Felix.Library.BLL.Market("YM");

            Assert.IsTrue(market.Name.Equals(expectedName));
            Assert.IsTrue(market.Exchange.Equals(expectedExchange));
            Assert.IsTrue(market.TickSize == expectedTickSize);
            Assert.IsTrue(market.Months.Equals(expectedMonths));

            foreach (var contract in market.Contracts)
            {
                var testContract = mockContracts.FirstOrDefault(c => c.ContractId == contract.ContractId);

                Assert.IsTrue(TheseContractsMatch(contract, testContract));
            }

            foreach (var meta in market.MetaMappings)
            {
                var testMeta = mockMetaMappings.FirstOrDefault(c => c.MetaMappingId == meta.MetaMappingId);

                if (testMeta == null)
                {
                    Debugger.Break();
                }

                Assert.IsTrue(TheseMetaMappingsMatch(meta, testMeta));
            }
        }