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_balance
DataSourceValue of asset held by Binance. Updated monthly. Available for BTC, ETH, SOL, USDT & USDC
buy_sell_volume
DataSourceBuy/sell volume from trade data
cme_oi
DataSourceOpen Interest for crypto futures contracts on the Chicago Mercantile Exchange, Only available for BTC and ETH
etf_flow
DataSourceNet inflow or outflow of capital into an ETF. Only available on 1D intervals
etf_holding
DataSourceAsset balance held by major ETFs. Available for BTC, ETH and SOL based ETFs. Currency can be specified under coin or USD (coin by default)
ethena_positions
DataSourceAmount of collateral within the Ethena protocol
funding_rate
DataSourceFunding rate aggregation data from derivatives markets
liquidations
DataSourceLiquidation aggregation data from derivatives markets
long_short_ratio
DataSourceOverall 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
ohlcv
DataSourceOpen, High, Low, Close, Volume data from trade aggregations
open_interest
DataSourceOpen interest aggregation data from derivatives markets
options_open_interest
DataSourcePuts and Calls for a particular coin from Binance Options or Deribit based on open interest. Limited to ETH and BTC coins
orderbook
DataSourceOrderbook heatmap snapshot aggregation data
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
Derivatives & Futures
Futures, perpetuals, and derivative market metrics
Options & Volatility
Options data, implied volatility, and skew metrics
Lending & Margin
Margin rates, lending markets, and credit data
Institutional & ETF
ETF flows, institutional holdings, and treasury data
Protocols & DeFi
Protocol-specific metrics and DeFi 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.