All Collections
Custom Functions
CS.OHLCV - Pull Historical OHLCV Data in Cryptosheets using custom functions
CS.OHLCV - Pull Historical OHLCV Data in Cryptosheets using custom functions

Pull 100,000+ rows of OHLCV data from over 11,000 symbols directly into Excel & Googlesheets using =CS.OHLCV

J
Written by John Young
Updated over a week ago

OVERVIEW

The =CS.OHLCV formula is a Cryptosheets core function meaning it can be used without specifying a provider to return detailed historical data for nearly any pair across over 290+ exchanges

👉  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 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

  1. Syntax & Function Arguments

  2. Examples

  3. 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)

  • quote: Symbol of asset or currency to convert into (required)

  • exchange: Name of exchange (required)

  • type: 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)

  • timeStart: Timeseries starting time

  • timeEnd: Timeseries ending time

  • arguments: 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) 

(*Note - {"curly_brackets"} are NOT required when using referenced values)

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

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)

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

  • Exchange — Exchange of requested timeseries (ex. Coinbase)

  • Current — Toggle to pull current vs. historical

  • Limit — Row limiter

  • Headers — Toggle for table headers

  • Resolutions — Timespan for each candlestick

Headers

  • Type — Type of data being pulled

  • Exchange — Exchange where data is pulled from

  • From Symbol — Asset quote

  • To Symbol — Asset base

  • Open — First trade price inside period range

  • High — Highest traded price inside period range

  • Low — Lowest traded price inside period range

  • Close — Last trade price inside period range

  • Volume — Cumulative base amount traded inside period range

  • Trade Count — Amount of trades executed inside period range

  • Time Start (GMT) — Time of first trade inside period range

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

________________________________________________________________

2 ) EXAMPLES

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

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

👉  Custom Functions

Example 1: 

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

Example 2: 

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

👉  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


👉  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


Example 3:

Chart flawless OHCLV candle charts in seconds
with one click...

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



________________________________________________________________

RESOURCES

Troubleshooting

  1. Check your syntax for =CS.OHLCV() carefully, different functions for the same data may have slightly different required syntax

  2. Check the required arguments for =CS.OHLCV() vs the optional arguments

  3. Check your data & API quotas and limits

  4. Check your formulas carefully

  5. Check your relative references (=CS.OHLCV("BTC", "USD") vs. =CS.OHLCV("A1", "B1"))

  6. Use Excel's error checking tools

  7. Find additional troubleshooting resources and tips here

Other Something else? – Click here for full list of Excel error explanation

Additional Resources

For Microsoft Excel

Cryptosheets is free to sign up and start using now. What are you waiting for?

Signing up for Cryptosheets is free --> Get crypto data in 30 seconds or less


ADDITIONAL RESOURCES

Website  |  WebApp  |  Excel  |  Googlesheets  |  Help Center  | Blog  | Twitter
______________________________________________________________

TAGS : ohlcv, box and whisker, candles, custom functions, historical, excel, googlesheets, spreadsheet, crypto data, bitcoin, blockchain

Did this answer your question?