next(X) — Lead a series by 1 position! ⏩
next(x) shifts every element one index earlier; the last becomes NULL. next(price) - price yields tomorrow-minus-today returns — no loop needed.
#DolphinDB#TimeSeries#DataTransformation#Quantitative
mstd(X, window, [minPeriods]) — Rolling sample standard deviation! 📐
Set minPeriods=2 for partial results early. Pair with mavg for Bollinger Band calculations.
#DolphinDB#TimeSeries#QuantFinance#Statistics
maxDrawdown(X, [ratio=true]) — Maximum drawdown in one line! 📉
Returns peak-to-trough rate (default) or absolute drop (ratio=false). Alias: mdd. Group-by compatible for per-strategy MDD across a full backtest.
#DolphinDB#QuantFinance#QuantResearch#Statistics
nullFill(X, Y) — Replace NULL values without mutating the original! 🛡️
nullFill(x, 0) returns a new object — the original is untouched. Pass a same-length vector as Y for position-matched fills. For in-place filling, use nullFill!.
#DolphinDB#DataCleaning#DataPrep#ETL
mcorr(X, Y, window, [minPeriods]) — Rolling Pearson correlation between two series! 🔗
Lower minPeriods to get earlier results — useful for live pair-trading signal generation.
#DolphinDB#QuantFinance#TimeSeries#Analytics
mcount(X, window, [minPeriods=1]) — Count non-NULL values per rolling window! 🔢
mcount(x, 3) returns valid element count at each position. Pair with mavg/mstd to check data density before calculations.
#DolphinDB#DataPrep#DataCleaning#TimeSeries
now([nanoSecond=false]) — Current timestamp with one call! ⏱️
now() → TIMESTAMP (milliseconds). now(true) → NANOTIMESTAMP (nanoseconds). Essential for latency measurement, event logging, and timestamping streaming records.
#DolphinDB#TimeSeries
mad(X, [useMedian=false]) — Mean or median absolute deviation! 📊
Default: mean(abs(X - mean(X))). Set true for median-based MAD — more robust against outliers. NULLs ignored automatically.
#DolphinDB#Statistics
gmd5(X) — Global MD5 hash across all elements! 🔐
Unlike md5, gmd5 flattens tuples and array vectors first — so identical data always yields the same fingerprint. Great for deduplication and integrity checks.
#DolphinDB#DataPrep
gema(X, window, alpha) — EMA with explicit decay control! 📈
Set alpha (0–1) directly instead of deriving it from a window. Smaller alpha = slower response. More precise than ema for custom signal smoothing.
#DolphinDB#TimeSeries
tableUpsert(table, keyColNames, insertColNames, [mode]) — Upsert into a DFS table! 🔄📥
The distributed upsert operation for DFS tables. Specify which columns are keys and which get updated on conflict.
#DolphinDB#DatabaseManagement
twindow(T, X, window)** — Collect all values in a time window into a tuple! 📦⏱️
Unlike aggregation functions (tmsum, tmavg) that reduce the window to a single value, twindow preserves all elements as a tuple.
#DolphinDB#TimeSeries
tmove(T, X, window) — Time-based moving value shift! 🔄⏱️
Shifts X forward within each time window. Think of it as a time-aware lag or shift operation. .
#DolphinDB#TimeSeries
tmLowRange(T, X, window) — Time-based low range! 📊⏱️
The inverse of tmTopRange. Counts consecutive larger elements to the left within a time-length window. Use tmLowRange to detect "N-day low" conditions in price series.
#DolphinDB#TimeSeries
tmTopRange(T, X, window) — Time-based top range! 📊⏱️
The time-aware version of topRange. Counts consecutive smaller values to the left, but only within the time window. Perfect for "N-day high" detection that respects calendar boundaries.
#DolphinDB#TimeSeries
tmsum2(T, X, window) — Time-based rolling sum of squares! ➕✖️⏱️
Like tmsum but squares each element before summing. A building block for variance calculations (Var = E[X²] - E[X]²).
#DolphinDB#TimeSeries
tmstdp(T, X, window) — Time-based rolling population std! 📉⏱️
Population standard deviation counterpart of tmvarp. Together with tmvar, tmstd, tmvarp, and tmstdp, DolphinDB gives you all four variance/volatility variants.
#DolphinDB#TimeSeries
tmvarp(T, X, window) — Time-based rolling population variance! 📊⏱️
Like tmvar but computes population variance (divides by N, not N-1). Use when your window represents the entire population rather than a sample.
#DolphinDB#TimeSeries