דלגו לתוכן
פתיחת RaamTrade

Sessions

תוכן זה אינו זמין עדיין בשפה שלך.

A Session declares when the market is open and how bars are sliced. Strategies reference sessions by class name via Symbol(session=...); the platform uses the session to fetch broker data and align bar timestamps across venues.

class USEquityHourly(Session):
"""US Equities — hourly bars during the regular session."""
timezone = "America/New_York"
days = ["mon", "tue", "wed", "thu", "fri"]
bars = [
("09:30", "10:30"),
("10:30", "11:30"),
("11:30", "12:30"),
("12:30", "13:30"),
("13:30", "14:30"),
("14:30", "15:30"),
("15:30", "16:00"),
]
broker = {
"tradestation": {"sessionTemplate": "Default", "unit": "Minute", "interval": "60"},
}

Required fields

Field Type Notes
timezone string IANA timezone name (e.g. "America/New_York", "Asia/Jerusalem"). Governs the session’s bar windows and the wall clock strategies read from this session’s symbols via timestamp.
days list of strings Lowercase 3-letter abbreviations: "mon", "tue", "wed", "thu", "fri", "sat", "sun".
bars list of (start, end) tuples Each bar’s open and close times in "HH:MM" format, in the session’s timezone.

Optional fields

Field Type Notes
broker dict Broker-specific parameters used when fetching data. Keys are broker names ("tradestation", etc.).

The broker dict is a pass-through to the broker’s data API. Different brokers want different fields — consult the broker’s documentation.

Bar tuples are explicit

There is no interval shorthand — every bar window is written out as an explicit (start, end) tuple. A 30-minute session lists all 13 bars:

class USEquity30Min(Session):
"""30-minute bars, US equity. 13 bars/day."""
timezone = "America/New_York"
days = ["mon", "tue", "wed", "thu", "fri"]
bars = [
("09:30", "10:00"), ("10:00", "10:30"), ("10:30", "11:00"), ("11:00", "11:30"),
("11:30", "12:00"), ("12:00", "12:30"), ("12:30", "13:00"), ("13:00", "13:30"),
("13:30", "14:00"), ("14:00", "14:30"), ("14:30", "15:00"), ("15:00", "15:30"),
("15:30", "16:00"),
]
broker = {"tradestation": {"sessionTemplate": "Default", "unit": "Minute", "interval": "30"}}

Explicit tuples keep a session a pure, reviewable declaration — the list you read is exactly the bar schedule the platform trades on, with nothing generated behind your back.

Daily and longer

For daily bars, use a single tuple:

class USEquityDaily(Session):
"""US Equities — one daily bar."""
timezone = "America/New_York"
days = ["mon", "tue", "wed", "thu", "fri"]
bars = [("09:30", "16:00")]
broker = {"tradestation": {"sessionTemplate": "Default", "unit": "Daily", "interval": "1"}}

Weekly and monthly bars are broker pass-through — the session declares the trading calendar and the broker dict tells the broker to return aggregated bars.

The platform catalog also ships Daily1615 — daily bars over a Mon–Fri 09:30–16:15 ET window, covering the cash-index/VIX settlement window (e.g. $SPX.X, $VIX.X, which keep printing until 16:15):

trade = Symbol(session=Daily1615)

Use USEquityDaily for ordinary stocks and ETFs; use Daily1615 when the instrument settles at 16:15.

Why declare sessions at all?

Two reasons.

  1. Determinism. A backtest needs to know “what counts as a bar” without depending on broker-specific defaults that can change.
  2. Cross-venue alignment. When two symbols on different brokers share a session, their bars are aligned to the same wall-clock timestamps — multi-symbol strategies work consistently.

The session is the universal bar-timing contract. Strategies stay broker-agnostic; sessions resolve to broker-specific fetch parameters at deploy time.

Where sessions live

Sessions are declared once in your organization’s catalog and referenced by class name. You don’t redeclare them in every strategy — trade = Symbol(session=USEquityDaily) is a lookup, not a declaration.

The platform’s sessions

Times are New York time unless the row says otherwise. Futures bars per day count one full trading day (23 hours).

Session Name Market Hours Bars per day
USEquity1Min US Equity 1-Minute US stocks and ETFs Mon–Fri 09:30–16:00 390
USEquity5Min US Equity 5-Minute US stocks and ETFs Mon–Fri 09:30–16:00 78
USEquity15Min US Equity 15-Minute US stocks and ETFs Mon–Fri 09:30–16:00 26
USEquity30Min US Equity 30-Minute US stocks and ETFs Mon–Fri 09:30–16:00 13
USEquityHourly US Equity Hourly US stocks, ETFs and indexes Mon–Fri 09:30–16:00 7 (the last is 30 minutes)
USEquityHourlyBasedOn1Minute US Equity Hourly from 1-minute US stocks, ETFs and indexes Mon–Fri 09:30–16:00 7, built from 1-minute bars
USEquity2Hour US Equity 2-Hour US stocks and ETFs Mon–Fri 09:30–16:00 4 (the last is 30 minutes)
USEquityDaily US Equity Daily US stocks, ETFs and indexes Mon–Fri 09:30–16:00 1
USEquityWeekly US Equity Weekly US stocks and ETFs One bar per week —
USEquityMonthly US Equity Monthly US stocks and ETFs One bar per month —
Daily1615 Index Daily 16:15 Cash indexes and VIX Mon–Fri, day ends 16:15 1
Daily1615BasedOn1Minute Index Daily 16:15 from 1-minute Cash indexes and VIX Mon–Fri 09:30–16:15 1, built from 1-minute bars
DailyBy1MinuteExtendedHours Index Daily 16:15, extended hours Cash indexes and VIX Mon–Fri 09:30–16:15 1, built from 1-minute bars with extended-hours data
Futures1Min US Equity Futures 1-Minute US index futures Sun 18:00 – Fri 17:00, break 17:00–18:00 1,380
Futures3Min US Equity Futures 3-Minute US index futures Sun 18:00 – Fri 17:00, break 17:00–18:00 460
Futures5Min US Equity Futures 5-Minute US index futures Sun 18:00 – Fri 17:00, break 17:00–18:00 276
Futures15Minutes US Equity Futures 15-Minute US index futures Sun 18:00 – Fri 17:00, break 17:00–18:00 92
Futures30Min US Equity Futures 30-Minute US index futures Sun 18:00 – Fri 17:00, break 17:00–18:00 46
Futures1Hour US Equity Futures Hourly US index futures Sun 18:00 – Fri 17:00, break 17:00–18:00 23
Futures1Day US Equity Futures Daily US index futures Each bar 18:00 the evening before to 17:00 1
TelAvivDaily Tel Aviv Daily Tel Aviv stocks, ETFs and bonds Sun–Thu 09:59–17:25 Israel time 1
Forex4Hour Forex 4-Hour Forex Mon–Fri, around the clock 6
Forex24h1Min Forex 1-Minute Forex Sun 17:00 – Fri 17:00, no daily break 1,440
Forex24h5Min Forex 5-Minute Forex Sun 17:00 – Fri 17:00, no daily break 288
Forex24h15Min Forex 15-Minute Forex Sun 17:00 – Fri 17:00, no daily break 96
Forex24h1Hour Forex Hourly Forex Sun 17:00 – Fri 17:00, no daily break 24
Forex24h1Day Forex Daily Forex Each bar 17:00 the evening before to 17:00 1
Crypto1Hour Crypto Hourly Crypto Every day, around the clock (UTC) 24

The session id in the first column is what Symbol(session=...) and a connected AI use. The name is what you see in RaamTrade.

“From 1-minute” sessions

A few sessions build each bar out of 1-minute bars instead of asking for the bar directly. The bars come out on the same schedule. The difference shows in a Deep backtest: with a stop loss, take profit or trailing stop, it can follow the real path inside each bar instead of only the bar’s open, high, low and close. It is costlier to run, so use it when your strategy relies on those exits.

Common diagnostics

Code What it means
RC2_UNKNOWN_SESSION Session class in Symbol(session=...) doesn’t resolve to a declared session.