Skip to main content

Data Points

Data points are declarative wrappers that fetch and cache market data. You just declare once, and then access the data like a variable, with no repeated fetching logic needed.

The framework provides three powerful, high-level data helpers to simplify market data access and caching. These are designed to let your strategy focus on logic, not plumbing.

Available Data Points​

Helper NameDescription
getCandleDataSymFetches spot, futures, or option candles.
getCombinedPremiumBuilds synthetic OHLC by adding/subtracting 2 option leg prices.
getSyntheticFutComputes synthetic future

getCandleDataSym​

Purpose:​

  • Fetch candle data for a single instrument (spot, futures, or option).

  • Attribute access: After registration you call self.name and receive a fresh DataFrame on demand; internal caching keeps it fast.

Method Signature (inside data_init):​

self.getCandleDataSym(
dataType="spot",
name="dt_SPOT"
)

Example Use​

def data_init(self):
# 1-minute spot candles for today only
self.getCandleDataSym(
dataType="spot",
name="dt_SPOT"
)

# Weekly ATM Call Option candles with 1 day look-back
self.getCandleDataSym(
dataType="opt",
exp={"expType": "weekly", "expNo": 0},
strike={"by": "moneyness", "at": "atm"},
opType="CE",
dataLength=1,
name="dt_ATMCE"
)

getCombinedPremium​

Purpose:​

  • Aggregate 2 option series into one synthetic OHLC data series.
  • Return: merged DataFrame with OHLC V and greeks where available.

Example Use​

self.getCombinedPremium(
strikes=[
{
'exp': {'expNo': 0, 'expType': 'weekly'},
'opType': 'CE',
'strike': {'at': 'itm2', 'by': 'strike'}
},
'ADD',
{
'exp': {'expNo': 1, 'expType': 'weekly'},
'opType': 'PE',
'strike': {'at': 'atm', 'by': 'strike'}
}
],
dataLength=1,
candleType='candlestick',
timeFrame=None,
asof='10:05:00',
name='dt_combPrem'
)

Parameters​

ParameterTypeNotes
strikeslist[dict "ADD","SUB"]List of option leg dictionaries and operators ('ADD', 'SUB') to construct a synthetic series

getSyntheticFut​

Purpose:​

Built on top of getCombinedPremium, computes a synthetic future price series as:

  • Synthetic = Strike + ATM CE premium − ATM PE premium
  • Returns a price series closely tracking the underlying futures.

Example Use​

self.getSyntheticFut(
exp={'expNo': 0, 'expType': 'weekly'},
dataLength=1,
strike={'at': 'atm', 'by': 'strike'},
candleType='candlestick',
timeFrame=None,
asof='None',
name='dt_synthFUT'
)

getMultiData​

Purpose:​

Fetches market data for multiple symbols at a specific timestamp — useful when you need to access the same candle time across a basket of instruments (e.g., CE/PE pair, hedge legs).

getMultiData(symbols: list[str], ts: Optional[datetime.datetime] = None) -> dict

Parameters​

NameTypeDescription
symbolslist[str]List of full trading symbols to fetch data for (CE/PE/options/fut).
tsdatetime.datetime or NoneOptional. Candle timestamp (only from today). If None, uses current candle time.

Returns​

dict[str, dict] — A dictionary mapping each symbol to its market data at the specified time.

Example Use​

data = self.getMultiData(
symbols=["NIFTY17APR2522800CE", "NIFTY17APR2522800PE"],
ts=datetime.datetime(2025, 4, 11, 9, 29)
)
print(data["NIFTY17APR2522800CE"]["close"]) # e.g., 108.75

⚠️ Important Notes​

  • ts must be from today's date only — not allowed for past trading days.
  • If ts is not specified, it defaults to self.currentCandle["datetime"].
  • If symbol is invalid or unavailable at that ts, it may raise an error or return None.

Using the Data in Strategy​

Once registered, access your helper outputs anywhere in the strategy:

spot_close     = self.dt_SPOT.close.iloc[-1]
straddle_ohlc = self.dt_straddle.iloc[-1]
synth_high = self.dt_synthFUT.high.iloc[-1]

These are lazy-evaluated, internally cached pandas.DataFrame objects.


Data Points Parameters​

Parameters for getCandleDataSym​

ParameterTypeMeaning / Notes
dataType"spot" / "fut" / "opt"Instrument universe to query
expdictExpiry info (only for options/futures). Example: "expType": "weekly", "expNo": 0 (nearest expiry)
strikedictStrike selector (for options). See below
opType"CE" / "PE"Option type — Call or Put (only for options)
dataLengthintNumber of past trading days to include.
candleType"candlestick" / "heikenashi"Candle style. Heiken Ashi is converted after fetch
timeFrameint (minutes)Candle timeframe, defaults to engine's timeframe
namestrAttribute label (e.g. "dt_FUT") for access in strategy
asof"HH:MM:SS" or NoneLock strike selection to time-of-day. If None then ignores asof.

Expiry Parameters​

ParameterTypeMeaning / Description
expType"weekly" / "monthly"Type of option expiry to use
expNo0 / 10 means nearest expiry, 1 means next

Strike Parameters​

by Valueat Value ExamplesMeaning / Description
"strike"
  • "atm": At-the-money strike
  • "itm8": 8 strikes In-The-Money
  • "otm3": 3 strikes Out-Of-The-Money

Absolute strike offset relative to ATM.
Range: itm10 to otm10

"premium near"int (e.g., 100)Closest strike with premium near ₹100. range(0-9999)
"premium above"int (e.g., 100)First strike with premium > ₹100. range(0-9999)
"premium below"int (e.g., 100)First strike with premium < ₹100. range(0-9999)