Registry / data / pinets

pinets

JSON →
library0.9.13jsnpmunverified

PineTS is an open-source transpiler and runtime that executes Pine Script (TradingView's indicator language) in Node.js, browsers, and other JavaScript runtimes. Version 0.9.13 is the latest stable release, with active development and biweekly releases. Key differentiators include 1:1 syntax compatibility with Pine Script v5, support for multiple data providers (Binance, CSV, custom), and full TypeScript types. Unlike alternatives (e.g., pine-js), PineTS is a full runtime with a built-in transpiler and provider abstraction, enabling off-platform execution of indicators and strategies for backtesting, alerts, and ML pipelines.

npm install pinets
INSTALL
IMPORT
SIG · PINETS
P
pinets
datajavascriptv0.9.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PineTS
import { PineTS } from 'pinets'
const PineTS = require('pinets')
ESM-only. CommonJS require will not work.
Provider
import { Provider } from 'pinets'
import { Binance } from 'pinets'
Provider is an enum; access via Provider.Binance.
PineTS (default)
import PineTS from 'pinets'
import { default as PineTS } from 'pinets'
Default export is the same as named. Both work.
DataProvider
import { DataProvider } from 'pinets'
For custom data sources; not needed with built-in providers.
PineScriptError
import { PineScriptError } from 'pinets'
Type for errors thrown by Pine Script execution.

Initializes PineTS with Binance BTCUSDT 1h data and runs a simple EMA cross Pine Script, logging the first 5 values of each plot.

import { PineTS, Provider } from 'pinets'; const pineTS = new PineTS(Provider.Binance, 'BTCUSDT', '1h', 100); async function main() { const { plots } = await pineTS.run(` //@version=5 indicator("EMA Cross") plot(ta.ema(close, 9), "Fast", color.blue) plot(ta.ema(close, 21), "Slow", color.red) `); console.log('Fast EMA:', plots['Fast'].data.slice(0, 5)); console.log('Slow EMA:', plots['Slow'].data.slice(0, 5)); } main().catch(console.error);
Debug
Known issues
breakingProvider enum changed in v0.8.0: old string-based provider names (e.g., 'binance') no longer accepted. Use Provider.Binance.
fix
Replace provider strings with enum values: Provider.Binance, Provider.BinanceFutures, etc.
affects: >=0.8.0
breakingrun() method returns object with `plots` key instead of array since v0.9.0.
fix
Access plots via plots['name'] instead of destructuring from array.
affects: >=0.9.0
deprecatedUsing require('pinets') is deprecated as of v0.9.0. Package is ESM-only moving forward.
fix
Switch to ES module imports: import { PineTS } from 'pinets'.
affects: >=0.9.0
gotchaPine Script strings must use backticks or escaped quotes inside JavaScript strings. Template literals work best.
fix
Use backticks for multi-line Pine code to avoid escaping issues.
affects: all
gotchaData fetched from Binance may have gaps; ensure at least 100 bars for reliable indicator calculations.
fix
Request extra bars (e.g., 200) to account for missing data or warmup.
affects: all
gotchaPlot data is returned as arrays with the same length as the requested bar count; first elements may be NaN due to indicator warmup.
fix
Filter out NaN values or slice after warmup period (e.g., plots['SMA 20'].data.slice(20)).
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'pinets'
Package not installed or wrong import path.
fix
Run 'npm install pinets' and ensure you're using ESM imports.
TypeError: Provider.Binance is undefined
Provider enum not imported correctly.
fix
Use 'import { Provider } from 'pinets'' and access Provider.Binance.
SyntaxError: Unexpected token 'export'
Using CommonJS require on an ESM-only package.
fix
Switch to ES module syntax or add 'type': 'module' in package.json.
PineScriptError: line X: ... (Pine script compilation error)
Pine Script syntax error (e.g., missing //@version=5).
fix
Check Pine Script code for errors and ensure version pragma is included.
Upgrade
Version history
0.9.13latest on npm
Audit
Dependencies
node-fetchrequiredUsed for fetching market data from providers like Binance
tsliboptionalRequired for TypeScript runtime helpers
Agent activity
2 hits · last 30 days
node
2
Resources