pinets-cli supports two data sources: live market data from Binance and local JSON files.
Use --symbol and --timeframe to fetch live candle data from the Binance exchange.
pinets run rsi.pine --symbol BTCUSDT --timeframe 60Any symbol available on Binance:
- Spot:
BTCUSDT,ETHUSDT,SOLUSDT,BNBUSDT, etc. - Perpetual futures:
BTCUSDT.P,ETHUSDT.P(append.Pto the symbol)
The symbol is automatically uppercased, so btcusdt and BTCUSDT are equivalent.
- The CLI connects to the Binance public API (no API key required)
- It fetches the requested number of candles (
--candles+--warmup) - If the default Binance endpoint is unavailable, it automatically falls back to the Binance US endpoint
| Value | Period | Value | Period |
|---|---|---|---|
1 |
1 minute | 120 |
2 hours |
3 |
3 minutes | 240 |
4 hours |
5 |
5 minutes | 1D / D |
1 day |
15 |
15 minutes | 1W / W |
1 week |
30 |
30 minutes | 1M / M |
1 month |
60 |
1 hour |
Binance allows up to 1000 candles per API request. For larger counts, pinets-cli automatically paginates by making multiple requests.
Use --data to load candle data from a local JSON file. This is useful for:
- Offline analysis
- Custom data sources (other exchanges, CSV converted to JSON, etc.)
- Backtesting with historical datasets
- Reproducible results (same data every run)
pinets run my_indicator.pine --data ./candles.jsonThe JSON file must contain an array of candle objects in chronological order (oldest first):
[
{
"openTime": 1704067200000,
"open": 42000.50,
"high": 42500.00,
"low": 41800.00,
"close": 42300.00,
"volume": 1234.56,
"closeTime": 1704070799999
},
{
"openTime": 1704070800000,
"open": 42300.00,
"high": 42600.00,
"low": 42100.00,
"close": 42450.00,
"volume": 987.65,
"closeTime": 1704074399999
}
]| Field | Type | Description |
|---|---|---|
open |
number | Opening price |
high |
number | Highest price |
low |
number | Lowest price |
close |
number | Closing price |
volume |
number | Trading volume |
| Field | Type | Description |
|---|---|---|
openTime |
number | Candle open timestamp in milliseconds |
closeTime |
number | Candle close timestamp in milliseconds |
If openTime is not provided, the time values in the output will be undefined.
pinets-cli validates the JSON data on load:
- The file must parse as valid JSON
- The root element must be a non-empty array
- The first candle must contain all required fields (
open,high,low,close,volume)
If validation fails, a clear error message is shown:
Error: JSON candle data is missing required fields: volume
When using JSON data:
--candlescontrols how many entries appear in the output (taken from the end)--warmupis effectively automatic - all candles before the output window serve as warmup- If the file has fewer candles than
--candles, all candles are included
# File has 1000 candles, output the last 100
pinets run rsi.pine --data big_dataset.json --candles 100- If
--datais provided, it is always used (even if--symbolis also specified) --timeframeis only relevant with--symboland is ignored with--data