Skip to content

Conversation

@btagliani
Copy link
Contributor

@btagliani btagliani commented Aug 16, 2025

Problem

Currently, Jesse has two restrictions that prevent users from easily backtesting with the most recent data:

  1. Cannot select today's date: Jesse throws an InvalidDateRange error when trying to backtest up to today's date, forcing users to manually select "yesterday" as the finish date. This is inconvenient and confusing.

  2. Fails when recent candles are missing: When selecting a date range where the most recent candles haven't been imported yet (e.g., selecting today when the last candle is from a few hours ago), Jesse throws a CandleNotFoundInDatabase error instead of just using the available data.

Solution

This PR removes these unnecessary restrictions to improve the user experience:

1. Allow Future Dates

  • Removed the validation that prevents selecting finish dates in the future
  • Users can now select "today" or any future date without errors
  • The system will use all available data up to the selected date

2. Auto-Adjust to Available Data

  • When recent candles are missing, the system now automatically adjusts to use the last available candle
  • Instead of throwing an error, it prints a helpful warning message and continues with the backtest
  • Example: If you select data until "2025-08-16 23:59" but the last candle is from "2025-08-16 07:34", it will automatically backtest until 07:34 and inform you of the adjustment

Benefits

  • Better UX: No more confusing errors when trying to backtest with recent data
  • Convenience: Users can always select "today" without worrying about the exact time of the last imported candle
  • Flexibility: The system intelligently uses all available data instead of failing

Test Plan

  • Backtest with a finish date of today - should work without errors
  • Backtest with a finish date in the future - should work without errors
  • Backtest with a date range where recent candles are missing - should adjust automatically
  • Verify warning messages appear when dates are adjusted
  • Ensure existing functionality remains intact for normal date ranges

Note on CI Failures

The CI failures are pre-existing issues unrelated to this PR. The tests are failing due to missing ray dependency for Python 3.13, which is a known issue in the master branch.

…efully

- Remove future date restriction: Allow backtesting with finish dates in the future
- Auto-adjust to last available candle: When recent candles are missing, automatically adjust the backtest period to use the last available candle instead of raising an exception
- Add warning message when adjusting dates to inform users about the adjustment

These changes improve the user experience by:
1. Removing unnecessary restrictions on future dates
2. Gracefully handling incomplete data by using what's available
3. Providing clear feedback when adjustments are made
@xsa-dev
Copy link

xsa-dev commented Sep 29, 2025

I also find these issues with backtests and optimizations really frustrating!
It’s a pity that Jesse can’t yet “heal” these gaps automatically — for example,
by asking for permission or at least notifying the user before running
potentially “unsafe” data processing.

Still, I see this as an opportunity for improvement and future growth 👍


Here are some of my related improvements that might be useful for reference:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants