Agentic Trading Lab
Talk to agents, and test trading ideas. Try AI trading agents on real market data with no code required.
AI translation
The complete crypto trading platform — backtest, trade manually or automate with bots, and journal every trade. Open source, AI-powered, and free forever.
FinanceTypeScript · ShellGitHub @GainiumOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
High-performance TypeScript technical indicators library with 45+ indicators optimized for real-time trading systems. Features memory-efficient architecture, complete type safety, and comprehensive documentation. Used in production by Gainium trading platform.
Taken from the repository README
Loading the full README.
Read the full README ↗A high-performance, TypeScript-based technical indicators library built for professional trading applications. This library provides 45+ comprehensive technical analysis indicators optimized for real-time trading systems with minimal memory footprint and maximum computational efficiency.
Author: Maksym Shamko (https://github.com/maksymshamko)
Organization: Gainium (https://github.com/Gainium | https://gainium.io/)
# Install from npm
npm install @gainium/indicators
# or
yarn add @gainium/indicators
import { RSI, SMA, MACD, BollingerBands } from '@gainium/indicators';
// Create indicators
const rsi = new RSI(14);
const sma = new SMA(20);
const macd = new MACD();
const bb = new BollingerBands(20, 2);
// Feed price data
const price = 100.50;
const candle = { open: 100, high: 101, low: 99.5, close: 100.50, volume: 1000 };
// Get results
const rsiValue = rsi.next(price); // Returns RSI value or null if not ready
const smaValue = sma.next(price); // Returns SMA value or null
const macdResult = macd.next(price); // Returns {value, signal, histogram} or null
const bbResult = bb.next(candle); // Returns {upper, middle, lower} or null
console.log('RSI:', rsiValue?.value); // Access RSI value
console.log('SMA:', smaValue); // Direct numeric value
console.log('MACD:', macdResult?.value); // MACD line value
console.log('BB Upper:', bbResult?.upper); // Bollinger Bands upper band
import { SuperTrend, StochasticOscillator } from '@gainium/indicators';
// Create indicators
const superTrend = new SuperTrend(10, 3.0);
const stoch = new StochasticOscillator(14, 3, 3);
// Process multiple candles
const candles = [
{ open: 100, high: 102, low: 99, close: 101, volume: 1000 },
{ open: 101, high: 103, low: 100, close: 102, volume: 1100 },
// ... more candles
];
candles.forEach(candle => {
const stResult = superTrend.next(candle);
const stochResult = stoch.next(candle);
if (stResult && stochResult) {
console.log('SuperTrend:', stResult.trend ? 'Uptrend' : 'Downtrend');
console.log('Stochastic %K:', stochResult.stochK);
console.log('Stochastic %D:', stochResult.stochD);
}
});
// Save and restore state for persistence
const state = superTrend.exportState();
// ... save state to database/file
const newSuperTrend = new SuperTrend(10, 3.0);
newSuperTrend.restoreState(state);
Single-line oscillators (RSI, CCI, MFI, WR, UO, MOM, AO, ADX, BBPB, KCPB, BBW,
VO, MAR) can be smoothed through the factory:
createIndicator({ type: IndicatorEnum.rsi, interval: 14, smoothing: 'ema', smoothingLength: 14 })
returns a SmoothedIndicator whose value is the smoothed line and raw the
oscillator's own value (feed it with feedCandle).
priceChangeCondition gt / lt / between)All indicators extend the LightIndicator base class, providing:
// Basic indicator structure
abstract class LightIndicator<T = number, I = number> {
next(value: I): T | null // Process new value
preview(value: I): T | null // Preview without updating state
get result(): T | null // Get current result
exportState(): LightIndicatorState // Serialize state
restoreState(state: LightIndicatorState): void // Restore state
}
Indicators accept different input types based on their requirements:
Indicators return typed results:
// Simple numeric result
const smaResult: number | null = sma.next(price);
// Complex result objects
const rsiResult: PercentileResult | null = rsi.next(price);
const macdResult: MACDResult | null = macd.next(price);
const bbResult: BollingerBandsResult | null = bb.next(candle);
import { EMA, RSI, MACD } from '@gainium/indicators';
class TradingStrategy {
private ema20 = new EMA(20);
private ema50 = new EMA(50);
private rsi = new RSI(14);
private macd = new MACD();
onNewCandle(candle: OHLCV) {
const ema20Val = this.ema20.next(candle.close);
const ema50Val = this.ema50.next(candle.close);
const rsiVal = this.rsi.next(candle.close);
const macdVal = this.macd.next(candle.close);
if (ema20Val && ema50Val && rsiVal && macdVal) {
// Golden cross with RSI confirmation
if (ema20Val > ema50Val && rsiVal.value < 70 && macdVal.histogram > 0) {
this.enterLong();
}
}
}
}
import { SuperTrend, BollingerBands } from '@gainium/indicators';
function analyzeHistoricalData(candles: OHLCV[]) {
const superTrend = new SuperTrend(10, 3.0);
const bb = new BollingerBands(20, 2);
const signals = candles.map(candle => {
const stResult = superTrend.next(candle);
const bbResult = bb.next(candle);
return {
timestamp: candle.timestamp,
price: candle.close,
trend: stResult?.trend,
bbPosition: bbResult ? (candle.close - bbResult.middle) / (bbResult.upper - bbResult.middle) : null
};
});
return signals.filter(s => s.trend !== null);
}
import { RSI, MACD } from '@gainium/indicators';
class MultiTimeframeAnalysis {
private rsi1h = new RSI(14);
private rsi4h = new RSI(14);
private rsi1d = new RSI(14);
// Call with appropriate timeframe data
update1h(price: number) { return this.rsi1h.next(price); }
update4h(price: number) { return this.rsi4h.next(price); }
update1d(price: number) { return this.rsi1d.next(price); }
getOverallSignal() {
const rsi1h = this.rsi1h.result?.value;
const rsi4h = this.rsi4h.result?.value;
const rsi1d = this.rsi1d.result?.value;
if (rsi1h && rsi4h && rsi1d) {
// All timeframes oversold
if (rsi1h < 30 && rsi4h < 40 && rsi1d < 50) return 'STRONG_BUY';
// All timeframes overbought
if (rsi1h > 70 && rsi4h > 60 && rsi1d > 50) return 'STRONG_SELL';
}
return 'NEUTRAL';
}
}
We welcome contributions! Please follow these guidelines:
All indicators must extend the LightIndicator base class:
export class MyIndicator extends LightIndicator<ResultType, InputType> {
constructor(period: number) {
super(historyLength, defaultValue, stateSize, fillValue);
}
protected calculate(): ResultType | null {
// Implementation
}
}
exportState() and restoreState() methodsMIT License - see LICENSE file for details.
This library powers the technical analysis engine in Gainium, a professional cryptocurrency trading platform trusted by thousands of traders worldwide.
Built with ❤️ by the Gainium team for the trading community.