npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pinets-cli

v0.1.5

Published

A CLI wrapper for PineTS that lets you run Pine Script indicators directly from the command line.

Readme


What is pinets-cli?

pinets-cli is a command-line interface for PineTS, the open-source Pine Script transpiler and runtime. It lets you execute TradingView Pine Script indicators directly from your terminal, with live market data or custom JSON datasets.

pinets run rsi.pine --symbol BTCUSDT --timeframe 60

No code to write. No project to set up. Just point it at a .pine file and go.


Quick Start

Install

npm install -g pinets-cli

Or run directly without installing:

npx pinets-cli run sma_cross.pine --symbol BTCUSDT --timeframe 60

Run your first indicator

Create a file called sma_cross.pine:

//@version=5
indicator("SMA Cross", overlay=true)
fast = ta.sma(close, 9)
slow = ta.sma(close, 21)
plot(fast, "Fast SMA", color=color.blue)
plot(slow, "Slow SMA", color=color.red)

Run it:

pinets run sma_cross.pine --symbol BTCUSDT --timeframe 60

That's it. You'll get JSON output with the calculated SMA values for the last 500 hourly candles.


Usage

pinets run [options] [file]

The run command executes a Pine Script indicator and outputs the results as JSON.

Indicator source

Provide the indicator as a file argument or via piped stdin:

# From a file
pinets run my_indicator.pine --symbol BTCUSDT

# Piped from stdin (works on Linux, macOS, and Windows)
cat my_indicator.pine | pinets run --symbol BTCUSDT

Data source

Choose between live market data or a local JSON file:

# Live data from Binance
pinets run rsi.pine --symbol BTCUSDT --timeframe 60

# Custom data from a JSON file
pinets run rsi.pine --data ./my_candles.json

Options

Data Source

| Option | Short | Description | Default | |--------|-------|-------------|---------| | --symbol <ticker> | -s | Symbol to query (e.g., BTCUSDT, ETHUSDT.P) | — | | --timeframe <tf> | -t | Timeframe: 1, 5, 15, 60, 240, 1D, 1W, 1M | 60 | | --data <path> | -d | Path to a JSON data file (alternative to --symbol) | — |

Output

| Option | Short | Description | Default | |--------|-------|-------------|---------| | --output <path> | -o | Write output to a file instead of stdout | stdout | | --format <type> | -f | Output format: default or full | default | | --pretty | — | Force pretty-printed JSON | auto | | --clean | — | Filter out null, false, and empty values from plots | — | | --plots <names> | — | Comma-separated list of plot names to include | all plots |

Candle Control

| Option | Short | Description | Default | |--------|-------|-------------|---------| | --candles <count> | -n | Number of candles in the output | 500 | | --warmup <count> | -w | Extra candles for indicator warmup (not included in output) | 0 |

Other

| Option | Short | Description | |--------|-------|-------------| | --debug | — | Show the transpiled code (for debugging) | | --quiet | -q | Suppress all informational messages | | --version | -v | Show version number | | --help | -h | Show help |


Examples

Basic indicator with live data

pinets run rsi.pine --symbol BTCUSDT --timeframe 1D --candles 100

Indicator warmup

Many indicators need historical data to initialize (e.g., a 200-period SMA needs at least 200 bars before producing meaningful output). Use --warmup to fetch extra candles that are processed but excluded from the output:

# Fetch 700 candles (200 warmup + 500 output), return only the last 500
pinets run ema200.pine --symbol ETHUSDT --timeframe 60 --candles 500 --warmup 200

Save output to a file

pinets run macd.pine --symbol BTCUSDT --timeframe 15 -o results.json

Pipe into other tools

# Pretty-print with jq
pinets run rsi.pine -s BTCUSDT -t 60 -q | jq '.plots'

# Extract last RSI value
pinets run rsi.pine -s BTCUSDT -t 60 -q | jq '.plots.RSI.data[-1].value'

Use custom JSON data

pinets run my_indicator.pine --data ./historical_btc.json --candles 50 --pretty

Pipe indicator from stdin

cat my_indicator.pine | pinets run --symbol BTCUSDT --timeframe 60

# Or on Windows PowerShell
Get-Content my_indicator.pine | pinets run --symbol BTCUSDT --timeframe 60

Full execution context

pinets run rsi.pine --symbol BTCUSDT --format full --pretty

Debug transpilation

pinets run my_indicator.pine --symbol BTCUSDT --debug

Filter signals with --clean

For indicators that generate signals (like crossovers), most candles will have false values. Use --clean to filter them out:

# Without --clean: 500 entries, mostly false
pinets run ma_cross.pine -s BTCUSDT -t 1D -n 500

# With --clean: Only actual signals
pinets run ma_cross.pine -s BTCUSDT -t 1D -n 500 --clean

Select specific plots

When you only need specific plots from an indicator:

# Get only the Fast SMA (ignore Slow SMA)
pinets run sma_cross.pine -s BTCUSDT --plots "Fast SMA"

# Get only Buy and Sell signals
pinets run signals.pine -s BTCUSDT --plots "Buy,Sell" --clean -q | jq '.plots'

Output Formats

default format

Contains the indicator metadata and all plot data:

{
  "indicator": {
    "title": "RSI",
    "overlay": false
  },
  "plots": {
    "RSI": {
      "title": "RSI",
      "options": { "color": "#7E57C2" },
      "data": [
        { "time": 1704067200000, "value": 65.42 },
        { "time": 1704070800000, "value": 62.18 }
      ]
    }
  }
}

full format

Everything in default, plus the raw execution result and market data:

{
  "indicator": { ... },
  "plots": { ... },
  "result": { ... },
  "marketData": [
    { "openTime": 1704067200000, "open": 42000, "high": 42500, "low": 41800, "close": 42300, "volume": 1234.5 },
    ...
  ]
}

JSON Data Format

When using --data, provide a JSON file with an array of candle objects:

[
  {
    "openTime": 1704067200000,
    "open": 42000.50,
    "high": 42500.00,
    "low": 41800.00,
    "close": 42300.00,
    "volume": 1234.56,
    "closeTime": 1704070799999
  }
]

Required fields: open, high, low, close, volume

Recommended fields: openTime, closeTime (millisecond timestamps)


How It Works

pinets-cli is a self-contained binary that bundles the PineTS library. When you run an indicator:

  1. The Pine Script file is read and passed to the PineTS transpiler
  2. Market data is fetched from Binance (or loaded from your JSON file)
  3. The indicator is executed bar-by-bar with full time-series semantics
  4. Plot data is collected and output as structured JSON

There are no runtime dependencies. The single bundled file includes everything needed.


Supported Timeframes

| Value | Description | |-------|-------------| | 1 | 1 minute | | 3 | 3 minutes | | 5 | 5 minutes | | 15 | 15 minutes | | 30 | 30 minutes | | 60 | 1 hour | | 120 | 2 hours | | 240 | 4 hours | | 1D or D | 1 day | | 1W or W | 1 week | | 1M or M | 1 month |


Related Projects

  • PineTS : The underlying transpiler and runtime engine
  • QFChart : Charting library optimized for PineTS visualization

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests.


License

AGPL-3.0 - See LICENSE for details.