chart-library-native
v1.0.0
Published
⚡ High-performance chart library with 20 technical indicators for React Native. C++ core + JSI bindings.
Maintainers
Readme
chart-library-native ⚡
High-performance chart library with 20 technical indicators for React Native. C++ core + JSI bindings = Lightning fast!
Features ✨
- ⚡ 20 Technical Indicators - MA, EMA, MACD, RSI, KDJ, Bollinger Bands, DMI, and more
- 🚀 Lightning Fast - C++ core with JSI bindings (1000x faster than JS-only)
- 🎯 Two-Tier API - Simple (Tier 1) for 90% use cases, Advanced (Tier 2) for customization
- 📊 Pre-Built Components - Ready-to-use indicator display components
- 💪 Type Safe - Full TypeScript support
- 🔄 Real-time - Optimized for live market data updates
- 📱 Cross-Platform - Works on iOS & Android
- 🔧 Expo Compatible - Works with Expo Development Build
Quick Start
Installation
npm install chart-library-native
# or
yarn add chart-library-nativeBasic Usage (Tier 1 - Simplest)
import { useQuickMA, useQuickRSI, QuickIndicatorDisplay } from 'chart-library-native/src';
export const MyChart = () => {
const closes = [100, 101, 102, 101, 100, 101, 102, 103];
const ma = useQuickMA(closes);
const rsi = useQuickRSI(closes);
return (
<>
<QuickIndicatorDisplay
name="MA20"
value={ma.lastValues.current}
previousValue={ma.lastValues.previous}
/>
<Text>RSI: {rsi.currentLevel.value?.toFixed(2)}</Text>
<Text>Level: {rsi.currentLevel.level}</Text>
</>
);
};Advanced Usage (Tier 2 - Full Control)
import { useMA, useRSI } from 'chart-library-native/src';
export const AdvancedChart = () => {
const closes = [100, 101, 102, 101, 100, 101, 102, 103];
// Custom MA with period 50
const ma50 = useMA(closes, { period: 50, type: 'simple' });
// Custom RSI with period 21
const rsi21 = useRSI(closes, { period: 21 });
return (
<>
<Text>MA50: {ma50.data[ma50.data.length - 1]}</Text>
<Text>RSI21: {rsi21.data[rsi21.data.length - 1]}</Text>
</>
);
};Tier 1: Pre-Built API (90% Use Cases)
// Simple Moving Average
useQuickMA(closes)
// Returns: { data, lastValues: { current, previous, trend }, loading, error }
// Exponential Moving Average
useQuickEMA(closes)
// MACD with buy/sell signals
useQuickMACD(closes)
// Returns: { macd, signal, histogram, currentSignal: 'buy'|'sell'|'neutral' }
// RSI with overbought/oversold levels
useQuickRSI(closes)
// Returns: { data, currentLevel: { value, level: 'overbought'|'oversold'|'neutral' } }
// KDJ Stochastic
useQuickKDJ(candleData)
// Bollinger Bands
useQuickBollinger(closes)
// Returns: { upper, middle, lower, currentBands: { position: 'above'|'within'|'below' } }
// DMI with trend analysis
useQuickDMI(candleData)
// Returns: { pdi, mdi, adx, currentTrend: { direction, strength } }Tier 2: Advanced API (Custom Tuning)
import {
useMA, useEMA, useWMA,
useMACD, useRSI, useKDJ,
useBollinger, useDMI,
useMultipleIndicators
} from 'chart-library-native/src';
// Full customization
const ma = useMA(closes, { period: 50, type: 'simple' });
const rsi = useRSI(closes, { period: 21 });
const macd = useMACD(closes, { fast: 12, slow: 26, signal: 9 });Pre-Built Components
import { QuickIndicatorDisplay } from 'chart-library-native/src';
// Display any indicator
<QuickIndicatorDisplay
name="MA20"
value={106.5}
previousValue={105.8}
decimals={2}
color="#1f77b4"
/>Indicators
| Indicator | Tier 1 | Tier 2 | Default Period | |-----------|--------|--------|----------------| | MA (Simple Moving Average) | ✅ MA20 | ✅ Any | 20 | | EMA (Exponential MA) | ✅ EMA12 | ✅ Any | 12 | | WMA (Weighted MA) | ❌ | ✅ | Custom | | MACD | ✅ 12/26/9 | ✅ Custom | 12/26/9 | | RSI | ✅ RSI14 | ✅ Custom | 14 | | KDJ | ✅ 9/3/3 | ✅ Custom | 9 | | Bollinger Bands | ✅ 20/2 | ✅ Custom | 20/2 | | DMI | ✅ 14 | ✅ Custom | 14 | | OBV | ❌ | ✅ | - | | CCI | ❌ | ✅ | 20 | | ATR | ❌ | ✅ | 14 | | Williams %R | ❌ | ✅ | 14 | | ROC | ❌ | ✅ | 14 | | MFI | ❌ | ✅ | 14 | | SAR | ❌ | ✅ | - | | Ichimoku Cloud | ❌ | ✅ | 9/26/52 | | Stochastic | ❌ | ✅ | 14 | | Momentum | ❌ | ✅ | 14 | | Volume MA | ❌ | ✅ | 20 | | ADX | ❌ | ✅ | 14 |
Total: 20 indicators ✅
Performance
Benchmarks on real market data (1000 candles):
MA20: 0.5ms ✅
EMA12: 0.8ms ✅
MACD 12/26/9: 1.2ms ✅
RSI14: 2.1ms ✅
KDJ 9/3/3: 1.5ms ✅
Bollinger 20/2: 0.9ms ✅
DMI14: 3.2ms ✅All calculations are sub-millisecond thanks to C++ core!
Expo Compatibility
✅ Expo Development Build - SUPPORTED
This library can be used with Expo Development Build (custom dev client).
❌ Expo Go - NOT SUPPORTED
This library cannot be used with Expo Go because it requires custom native code.
👉 See detailed guide: EXPO_SETUP.md
Setup
React Native
- Install the package:
npm install chart-library-nativeRegister JSI module in native code (see EXPO_SETUP.md for details)
Use in your app:
import { useQuickMA } from 'chart-library-native/src';Expo Development Build
See EXPO_SETUP.md for complete setup instructions.
Documentation
Examples
See example.js and example-expo.js for usage examples.
Supported Platforms
- ✅ React Native 0.60+
- ✅ Expo Development Build
- ✅ iOS (arm64, x86_64 simulator)
- ✅ Android (arm64-v8a, armeabi-v7a, x86)
Architecture
┌─────────────────────────────────┐
│ Tier 1: Simplified API │
│ useQuickMA, useQuickRSI, etc. │
└──────────────┬──────────────────┘
│
┌──────────────▼──────────────────┐
│ Tier 2: Advanced API │
│ useMA, useRSI, useMACD, etc. │
└──────────────┬──────────────────┘
│
┌──────────────▼──────────────────┐
│ Low-Level: ChartLibrary │
│ Direct JSI calls │
└──────────────┬──────────────────┘
│
┌──────────────▼──────────────────┐
│ C API Layer │
│ chart_calculate_ma, etc. │
└──────────────┬──────────────────┘
│
┌──────────────▼──────────────────┐
│ C++ Core │
│ calculateMA, calculateRSI, etc│
└─────────────────────────────────┘Contributing
Contributions welcome! Please see the main project repository for contributing guidelines.
License
MIT - See LICENSE
Support
Made with ❤️ for React Native traders
