CS.OHLCV — Pull Historical OHLCV Data in Cryptosheets using custom functions
By: Chris Ware
Tags: Blockchain, Trading, Bitcoin, Cryptocurrency

👉 In its simplest form, the CS.OHLCV function says:

=CS.OHLCV(what base symbol, what quote symbol, what exchange, what instrument type, what period interval, what start-time, what end-time)

Use a simple but powerful formula syntax

Start typing =CS… into your sheet then select the OHLCV function

👉 Use Case Scenarios

Use =CS.OHLCV() when you need:

maximum historical depth

symbol, exchange diversity

data granularity

variable resolutions

high level of control & flexibility

This function is slightly more advanced given the number of parameters it requires and amount of data it can rapidly return.

TIP: This function is also very powerful when used in conjunction with CS.ORDERBOOKS and CS.TRADES.

Table of Contents

Syntax & Function Arguments Examples Additional Resources

________________________________________________________________

1 ) CS.OHLCV — Syntax

Function arguments

Arguments:

=CS.OHLCV("base","quote","exchange","type","period","timeStart","timeEnd","argument,"argumentValue")

Values:

=CS.OHLCV("BTC","USD","coinbase","spot","1day")

Function argument descriptions

base : The cryptocurrency symbol of interest (required)

: The cryptocurrency symbol of interest (required) quote : Symbol of asset or currency to convert into (required)

: Symbol of asset or currency to convert into (required) exchange : Name of exchange (required)

: Name of exchange (required) type : Type of instrument and price ie spot or futures, index, perpetual (required)

: Type of instrument and price ie spot or futures, index, perpetual (required) period : The time period for each candle aka the resolution (ie 1MIN, 1DAY, 1YRS) (required)

: The time period for each candle aka the resolution (ie 1MIN, 1DAY, 1YRS) (required) timeStart : Timeseries starting time

: Timeseries starting time timeEnd : Timeseries ending time

: Timeseries ending time arguments : Universal argument parameters (optional) configurable for use with any provider or endpoint combination

: Universal argument parameters (optional) configurable for use with any provider or endpoint combination 👉 TIP: in Cryptosheets core functions, there is a special formatDates argument available ➡️ it is an extremely powerful and easy to use date formatting tool you can convert to/from dozens of different types of date formats (it's literally so cool we wrote an entire tutorial and custom template for it)

HINT: if you ever get stuck on the syntax for a specific function formula, you can use the side panel console to look them up — including these tutorials!

PARAMETERS — Absolute vs. Relative

Absolute Parameter Values

Formulas using absolute values (instead of cell references) for arguments with multiple parameters must be referenced inside an array using {"curly_brackets"}

…and will look like this:

=CS.OHLCV("btc","usd","coinbase","spot","1day")

Absolute AND Relative Parameter Values

Formulas also using referenced values for arguments with multiple parameters can be referenced individually by cell address

…and will look like this:

=CS.OHLCV("btc","usd",L4,L5,L6,L7,L8)

Relative Provider, Endpoint & Parameter Values

Formulas using referenced values for arguments with multiple parameters must be referenced inside an array using a defined range

…and will look like this:

=CS.OHLCV(B1,B2,A3:B4)

👉 TIP: Use the fields argument to select, reorder and configure the output columns however you want

Use the fields argument to customize your data outputs

Data pulls in this section are related to downloading OHLCV (Open, High, Low, Close, Volume) timeseries data. Each data point of this timeseries represents several indicators calculated from transactions activity inside a time range (period).

Options

From Symbol — From identifier of requested timeseries (ex. Bitcoin)

— From identifier of requested timeseries (ex. Bitcoin) To Symbol — To identifier of requested timeseries (ex. US Dollar)

— To identifier of requested timeseries (ex. US Dollar) Exchange — Exchange of requested timeseries (ex. Coinbase)

— Exchange of requested timeseries (ex. Coinbase) Current — Toggle to pull current vs. historical

— Toggle to pull current vs. historical Limit — Row limiter

— Row limiter Headers — Toggle for table headers

— Toggle for table headers Resolutions — Timespan for each candlestick

Headers

Type — Type of data being pulled

— Type of data being pulled Exchange — Exchange where data is pulled from

— Exchange where data is pulled from From Symbol — Asset quote

— Asset quote To Symbol — Asset base

— Asset base Open — First trade price inside period range

— First trade price inside period range High — Highest traded price inside period range

— Highest traded price inside period range Low — Lowest traded price inside period range

— Lowest traded price inside period range Close — Last trade price inside period range

— Last trade price inside period range Volume — Cumulative base amount traded inside period range

— Cumulative base amount traded inside period range Trade Count — Amount of trades executed inside period range

— Amount of trades executed inside period range Time Start (GMT) — Time of first trade inside period range

— Time of first trade inside period range Time End (GMT) — Time of last trade inside period range

________________________________________________________________

TIP: Try copying + pasting the example formulas directly into your worksheet

2 ) EXAMPLES

There are 3 primary ways to use CS.OHLCV in Cryptosheets:

👉 Custom Functions

Example 1:

=CS.OHLCV("btc","usd","coinbase","spot","1day")

Historical BTC/USD data from Coinbase

Example 2: =CS.OHLCV("btc","usd","mtgox","spot","1day","1/1/2011"."1/1/2012")

Historical BTC/USD data from Mt. Gox in 2011!

👉 Quick Start Templates (Excel only)

Quick start templates are a very lightweight version of Cryptosheets regular templates. They are bare bone, without formatting and are designed to let users quickly interact with and learn custom functions. They can also be loaded with one click from the side panel! #HIGHFIVE

Load pre-built custom functions with one click!

👉 Power Templates

Cryptosheets provides dozens of premade templates that can be loaded anywhere anytime with one click and are ready to go. They can be loaded into your existing workbook as new tabs or loaded as entirely new workbooks.

TIP: Power templates are a new generation feature with enormous potential. If you're a power user ➡️ spend some extra time with these

Explore templates using the webapp

Example 3:

Chart flawless OHCLV candle charts in seconds with one click…

Charting dynamic historical OHLCV candle charts is now an ‘easy’ task

Example 4:

Load some of our examples that include built in drop down menus, built in tooltips, guides and more