Exemple #1
0
        public void Transaction_import_positions()
        {
            Assert.AreEqual(0, this.tradingData.Get <IEnumerable <Position> >().Count());

            string       ef     = String.Concat(ProjectRootFolderNameFactory.Make(), "\\TestData\\positions.txt");
            ITransaction import = new ImportPositionsTransaction((IObservableHashSetFactory)this.tradingData, ef);

            import.Execute();

            Assert.AreEqual(3, this.tradingData.Get <IEnumerable <Position> >().Count());
        }
Exemple #2
0
        public void Transaction_import_bars_when_file_exists()
        {
            string path = String.Concat(ProjectRootFolderNameFactory.Make(), "\\TestData\\SPFB.RTS_130807_130807.txt");

            Assert.AreEqual(0, this.marketData.Get <ObservableCollection <Bar> >().Count);

            ITransaction import = new ImportBarsTransaction(this.marketData.Get <ObservableCollection <Bar> >(), path);

            import.Execute();

            Assert.AreEqual(7, this.marketData.Get <ObservableCollection <Bar> >().Count);
        }
Exemple #3
0
        public void Transaction_import_signal_only_for_existent_strategy()
        {
            StrategyHeader strategyHeader = new StrategyHeader(1, "First strategyHeader", "BP12345-RF-01", "RTS-9.13_FT", 10);

            this.tradingData.Get <ICollection <StrategyHeader> >().Add(strategyHeader);

            Assert.AreEqual(0, this.tradingData.Get <IEnumerable <Signal> >().Count());

            string       ef     = String.Concat(ProjectRootFolderNameFactory.Make(), "\\TestData\\signals.txt");
            ITransaction import = new ImportSignalsTransaction(this.tradingData, ef);

            import.Execute();

            Assert.AreEqual(1, this.tradingData.Get <IEnumerable <Signal> >().Count());
        }
 public void Transaction_Setup()
 {
     this.tradingData = new TradingDataContext();
     this.path        = String.Concat(ProjectRootFolderNameFactory.Make(), "\\TestData\\orders.txt");
 }
Exemple #5
0
 public void Transaction_Setup()
 {
     this.tradingData = new TradingDataContext();
     this.ef          = String.Concat(ProjectRootFolderNameFactory.Make(), "\\export-signals.txt");
 }
Exemple #6
0
        public void ignore_signals_when_backup_loaded_at_not_trading_time()
        {
            ITransaction importSignals = new ImportSignalsTransaction(this.tradingData, ProjectRootFolderNameFactory.Make() + "\\TestData\\signals-backup.txt");
            ITransaction importOrders  = new ImportOrdersTransaction((IObservableHashSetFactory)this.tradingData, ProjectRootFolderNameFactory.Make() + "\\TestData\\orders-backup.txt");
            ITransaction importTrades  = new ImportTradesTransaction((IObservableHashSetFactory)this.tradingData, ProjectRootFolderNameFactory.Make() + "\\TestData\\trades-backup.txt");

            importSignals.Execute();
            importOrders.Execute();
            importTrades.Execute();

            Assert.AreEqual(1, this.tradingData.Get <IEnumerable <Signal> >().Count());
            Assert.AreEqual(1, this.tradingData.Get <IEnumerable <Order> >().Count());
            Assert.AreEqual(1, this.tradingData.Get <IEnumerable <Trade> >().Count());
            Assert.AreEqual(1, this.tradingData.Get <IEnumerable <Position> >().Count());
            Assert.AreEqual(0, this.signalQueue.Count);
            Assert.AreEqual(0, this.orderQueue.Count);
            Assert.AreEqual(0, ((MockOrderManager)this.orderManager).PlaceCounter);
        }
Exemple #7
0
        public void BarsFactory_Load_All_Bars_From_File()
        {
            IEnumerable <Bar> bars = BarsFactory.Make(String.Concat(ProjectRootFolderNameFactory.Make(), "\\App_Data\\Import\\SPFB.RTS_120901_121001_Hour.txt"));

            Assert.AreEqual(294, bars.Count());
        }
Exemple #8
0
        public void BarsFactory_Make_ForHour()
        {
            IEnumerable <Bar> bars = BarsFactory.Make(String.Concat(ProjectRootFolderNameFactory.Make(), "\\TestData\\SPFB.RTS.txt"));

            Assert.AreEqual(574, bars.Count());
        }