Data Access Methods

kScript v2 provides two ways to access market data:

1. Direct Functions (Recommended)

Use dedicated functions for each data source - cleaner and more readable:

2. Universal source() Function

Use the general source() function with a data type parameter:

Available Data Sources

kScript provides access to 18 different data sources covering price data, derivatives, options, lending markets, and institutional flows.

binance_treasury_balanceDataSource
institutional

Value of asset held by Binance. Updated monthly. Available for BTC, ETH, SOL, USDT & USDC

Example:
buy_sell_volumeDataSource
price

Buy/sell volume from trade data

Properties:
buysell
Example:
cme_oiDataSource
derivatives

Open Interest for crypto futures contracts on the Chicago Mercantile Exchange, Only available for BTC and ETH

Properties:
openhighlowclose
Example:
deribit_implied_volatilityDataSource
options

Implied volatility of ticker on Deribit. Available to only BTC and ETH coins. Returns tenors of 1W, 1M and 3M

Properties:
one_weekone_monththree_months
Example:
deribit_volatility_indexDataSource
options

Measure of implied or historical price volatility for a specific asset on Deribit. Limited to ETH and BTC coins. Returns OHLC data

Properties:
openhighlowclose
Example:
etf_flowDataSource
institutional

Net inflow or outflow of capital into an ETF. Only available on 1D intervals

Example:
etf_holdingDataSource
institutional

Asset balance held by major ETFs. Available for BTC, ETH and SOL based ETFs. Currency can be specified under coin or USD (coin by default)

Example:
etf_premium_rateDataSource
institutional

Compares market price of an ETF with its net asset value (NAV). Available for BTC, ETH and SOL based ETFs

Example:
ethena_positionsDataSource
protocols

Amount of collateral within the Ethena protocol

Example:
funding_rateDataSource
derivatives

Funding rate aggregation data from derivatives markets

Example:
liquidationsDataSource
derivatives

Liquidation aggregation data from derivatives markets

Properties:
buysell
Example:
long_short_ratioDataSource
derivatives

Overall ratio of long to short positions across all traders. Available for Binance, Bybit and OKX exchanges. Updates every 5 minutes. Returns ratio of all accounts, top trader accounts, and top trader positions

Properties:
total_accounttop_trader_accounttop_trader_position
Example:
ohlcvDataSource
price

Open, High, Low, Close, Volume data from trade aggregations

Properties:
openhighlowclosevolume
Example:
open_interestDataSource
derivatives

Open interest aggregation data from derivatives markets

Properties:
openhighlowclose
Example:
options_volumeDataSource
options

Puts and Calls for a particular coin from Binance Options or Deribit based on volume. Limited to ETH and BTC coins

Properties:
putscalls
Example:
options_open_interestDataSource
derivatives

Puts and Calls for a particular coin from Binance Options or Deribit based on open interest. Limited to ETH and BTC coins

Properties:
putscalls
Example:
orderbookDataSource
price

Orderbook heatmap snapshot aggregation data

Example:
skewDataSource
options

Measures the percentage difference in implied volatility between call and put options for a specific ticker on Deribit. Limited to BTC and ETH coins with Deltas of 15 and 25. Returns Tenors of 1W, 1M and 3M

Properties:
one_weekone_monththree_months
Example:

Data Source Categories

Data sources are organized into categories based on the type of market information they provide.

📈

Price & Volume

Core market data including price, volume, and orderbook dynamics

buy_sell_volumeohlcvorderbook
📊

Derivatives & Futures

Futures, perpetuals, and derivative market metrics

cme_oifunding_rateliquidations
📉

Options & Volatility

Options data, implied volatility, and skew metrics

deribit_implied_volatilityderibit_volatility_indexoptions_volume
💰

Lending & Margin

Margin rates, lending markets, and credit data

🏦

Institutional & ETF

ETF flows, institutional holdings, and treasury data

binance_treasury_balanceetf_flowetf_holding
🔗

Protocols & DeFi

Protocol-specific metrics and DeFi positions

ethena_positions

Common Usage Patterns

Examples of how to use different data sources in your trading strategies.

Basic Price Data

Access OHLCV data for price-based technical analysis.

Funding Rate Analysis

Monitor funding rates across perpetual futures markets.

Liquidation Monitoring

Track liquidation events and volumes for market sentiment.

Best Practices

🎯

Choose Appropriate Sources

Select data sources that match your strategy timeframe and requirements.

Cache Data References

Store data source references to avoid repeated function calls.

🔄

Handle Data Availability

Not all data sources are available for every symbol/exchange combination.

📖
Introduction
Overview of kScript language
🔍
Overview
Complete technical documentation
🚀
Quick Start
Get started with kScript basics
📋
Function Reference
Complete API reference guide
📚
Type System
Understanding kScript data types
General FAQ
Frequently asked questions about kScript
Best Practices
Guidelines for writing efficient kScript code
⚠️
Limitations
Known constraints and workarounds
🆕
Updates
v1 vs v2 differences and improvements
🔧
Core Concepts
Variables, data types & data sources
⚙️
Execution Model
Per-bar execution lifecycle and phases
🏷️
Keyword Arguments
Named parameters for clear function calls
🔗
Field Accessors
Dot notation for timeseries field access
🛠️
User-Defined Functions
Create custom reusable functions
🔗
Script Definition
Defining inputs and metadata
TimeSeries Management
Working with time-aligned data
🎯
Utility Functions
Helper functions and calculations
📈
Moving Averages
SMA, EMA and trend-following indicators
📊
Oscillators
RSI, Stochastic and momentum indicators
📈
Trend Indicators
Trend direction and strength analysis
📉
Volume Indicators
Volume-based analysis tools
📦
Orderbook Functions
Market depth analysis tools
🎨
Plotting & Visualization
Chart rendering and styling
🌈
Color Functions
Color manipulation and styling
📊
Data Subscriptions
Subscribe to OHLCV, trades, and orderbook data
🔄
Loops
For loops and while loops for iteration
🧮
Math Functions
Mathematical functions and constants
🏠
Go Home
Return to main landing page