Kshna
Python on the chart, Rust under the hood.
Kshna is a chart-first workspace for writing indicators and strategies in Python instead of Pine Script and backtesting them on a Rust engine. Every trade is marked on its candle, next to the metrics, the trade list and the equity curve.
It stands on two of my own libraries. v1charts draws the chart, and strategies can call the indicators built into v1indicators, such as SuperTrend.
- 01Python authoringStrategy and indicator code, side by side with the chart.
- 02Go control planeRoutes each run between the Rust engine and the Python worker.
- 03Rust engineOwns candle data, supported indicators, backtest replay, metrics and markers.
- 04Chart resultsTrade markers on the chart, plus metrics, a trade list and an equity curve.
When Kshna recognises the pattern, the Python runs on a Rust fast path. Otherwise it runs in a separate Python worker, and every result shows which one ran.
# SuperTrend Strategy # Uses v1indicators built-in SuperTrend def strategy(ctx): st, direction = ctx.ta.supertrend(ctx.high, ctx.low, ctx.close, 10, 3.0) entry = [False] * len(ctx.close) exit_ = [False] * len(ctx.close) for i in range(1, len(ctx.close)): if direction[i] is not None and direction[i-1] is not None: # Direction: 1 = bullish, -1 = bearish if direction[i] > 0 and direction[i-1] <= 0: entry[i] = True if direction[i] < 0 and direction[i-1] >= 0: exit_[i] = True return { "plots": {"SuperTrend": st}, "signals": {"entry": entry, "exit": exit_}, }
