QuantRocket

Interactive Strategy Development Questions


#1

Had a few questions/issues after working through interactive development tutorials:

  1. When specifying DB_TIMES, it appears we have to specify every individual moment in time (as opposed to a window). But if your database has 1 minute candles, you may want 1 minute resolution but only within say a 4 hour window in the day (or only for which data is valid/exists). Is there a way to achieve that? I tried using the CALENDAR feature for this, but still got after market data. I’d like to just get 1 minute data between 10am - 2pm for example. My issue is that I’m getting a bunch of Nan data during the off-market times, which makes my signal generation more complicated and prone to errors.

  2. When developing interactively, I specify a start_date for get_historical_prices(), but it seems it is ignored. I still get data as far back as the database has data. I used this:
    prices = self.get_historical_prices(start_date='2019-05-25', end_date='2019-06-03')
    print(prices)
    This resulted in printing out prices as far back as 2018-04-01.

  3. To optimize data retrieving for intraday trading, is there a way to have only a certain amount of data passed to prices_to_signals (for example, only the most recent 10 days?), or is that managed by just limiting data in the database itself specified by DB? My idea is to keep the data passed to prices_to_signals larger for backtesting, but make it as small as feasible for live trading.

Thanks.


#2
  1. I would use pd.date_range to generate a list of times and paste it into your code if you don’t want to type them all. Also see the between_times parameter for create_db.
  2. Please review the documentation on lookback windows.
  3. For backtesting, look at segmented backtests. For live trading, the lookback window will determine the data volume.