def setup(self):
     data_catalog_setup()
     dask.config.set(scheduler="single-threaded")
     aud_usd_data_loader()
     self.catalog = DataCatalog.from_env()
     self.backtest_config = BacktestRunConfig(
         engine=BacktestEngineConfig(),
         venues=[
             BacktestVenueConfig(
                 name="SIM",
                 venue_type="ECN",
                 oms_type="HEDGING",
                 account_type="MARGIN",
                 base_currency="USD",
                 starting_balances=["1000000 USD"],
                 # fill_model=fill_model,  # TODO(cs): Implement next iteration
             )
         ],
         data=[
             BacktestDataConfig(
                 catalog_path="/root",
                 catalog_fs_protocol="memory",
                 data_cls_path="nautilus_trader.model.data.tick.QuoteTick",
                 instrument_id="AUD/USD.SIM",
                 start_time=1580398089820000000,
                 end_time=1580504394501000000,
             )
         ],
     )
예제 #2
0
 def setup(self):
     data_catalog_setup()
     self.catalog = DataCatalog.from_env()
     self.venue_config = BacktestVenueConfig(
         name="SIM",
         venue_type="ECN",
         oms_type="HEDGING",
         account_type="MARGIN",
         base_currency="USD",
         starting_balances=["1000000 USD"],
         # fill_model=fill_model,  # TODO(cs): Implement next iteration
     )
     self.data_config = BacktestDataConfig(
         catalog_path="/root",
         catalog_fs_protocol="memory",
         data_cls_path="nautilus_trader.model.data.tick.QuoteTick",
         instrument_id="AUD/USD.SIM",
         start_time=1580398089820000000,
         end_time=1580504394501000000,
     )
     self.backtest_configs = [
         BacktestRunConfig(
             engine=BacktestEngineConfig(),
             venues=[self.venue_config],
             data=[self.data_config],
         )
     ]
     self.strategies = [
         ImportableStrategyConfig(
             path="nautilus_trader.examples.strategies.ema_cross:EMACross",
             config=EMACrossConfig(
                 instrument_id="AUD/USD.SIM",
                 bar_type="AUD/USD.SIM-100-TICK-MID-INTERNAL",
                 fast_ema_period=10,
                 slow_ema_period=20,
                 trade_size=Decimal(1_000_000),
                 order_id_tag="001",
             ),
         )
     ]
    def setup(self):
        # Fixture Setup
        data_catalog_setup()

        config = BacktestEngineConfig(
            bypass_logging=True,
            run_analysis=False,
        )
        self.engine = BacktestEngine(config=config)

        self.venue = Venue("BETFAIR")

        data = BetfairDataProvider.betfair_feed_parsed(
            market_id="1.166811431.bz2", folder="data/betfair")
        instruments = [d for d in data if isinstance(d, BettingInstrument)]

        for instrument in instruments[:1]:
            trade_ticks = [
                d for d in data if isinstance(d, TradeTick)
                and d.instrument_id == instrument.id
            ]
            order_book_deltas = [
                d for d in data if isinstance(d, OrderBookData)
                and d.instrument_id == instrument.id
            ]
            self.engine.add_instrument(instrument)
            self.engine.add_ticks(trade_ticks)
            self.engine.add_order_book_data(order_book_deltas)
            self.instrument = instrument
        self.engine.add_venue(
            venue=self.venue,
            venue_type=VenueType.EXCHANGE,
            account_type=AccountType.MARGIN,
            base_currency=None,
            oms_type=OMSType.NETTING,
            starting_balances=[Money(10_000, GBP)],
            book_type=BookType.L2_MBP,
        )
예제 #4
0
 def setup(self):
     data_catalog_setup()
     self.catalog = DataCatalog.from_env()
     self.fs: fsspec.AbstractFileSystem = self.catalog.fs
     self._loaded_data_into_catalog()
 def setup(self):
     data_catalog_setup()
     self.catalog = DataCatalog.from_env()
     self.fs = self.catalog.fs
     self.reader = BetfairTestStubs.betfair_reader()
예제 #6
0
 def setup(self):
     data_catalog_setup()
     self.catalog = DataCatalog.from_env()
     self.reader = MockReader()
     self.line_preprocessor = TestLineProcessor()
예제 #7
0
 def setup(self):
     data_catalog_setup()
     self.catalog = DataCatalog.from_env()
     self.fs = self.catalog.fs
     self._loaded_data_into_catalog()