# Workbench Guide

A guide to functions available in the Workbench product on Glassnode.

Workbench is a powerful tool in Glassnode Studio enabling analysts to compare, assess and create a variety of metrics available on the platform.

For practical hands-on tutorials on how you can use Workbench, check out the following dashboards:

### Functions Guide

The table below provides a guide to the use of various workbench functions available to analyse datasets.

#### Input Values

`m1, m2`

etc. refer to a particular dataset added to the chart.

`n`

is a float value.

`period`

is an integer value defining the number of trailing data-points considered by the function, applied to the data resolution specified (i.e. a simple moving average with period 30 will consider 30-days for daily resolution data, and 30-weeks for weekly resolution data).

`since`

is a timestamp in format `"YYYY-MM-DD HH:mm:ss"`

(quotations required in syntax). Timestamps can be shortened from left to right, for example `"2010"`

will resolve from 01-Jan-2010 onwards, and `"2010-06"`

will resolve from 01-June-2010 onwards.

Functions may be nested, such that any input timeseries (i.e. `m1`

) may be replaced by a function to be evaluated, for example `sma(m1, 7)`

.

When timeseries of different resolutions are compared (i.e. subtracting a metric with resolution 1d from a metric with 1h resolution), workbench will perform the operation at the larger resolution (1d in this case), and use the 00:00 UTC timestamp of the smaller resolution. `period`

resolution is defined by the largest resolution of the timeseries being compared.

Workbench Function | Syntax | Function Description |
---|---|---|

Horizontal Line | float value e.g. | Draws a horizontal line at the specified y-ordinate. |

Simple Moving Average |
| Returns a simple moving average of dataset m1 with a period length specified. |

Exponential Moving Average |
| Returns an exponential moving average of dataset m1 with a period length specified. |

Moving Median |
| Returns a moving median of dataset m1 with a period length specified. |

Rolling Sum |
| Returns a rolling sum of dataset m1 with a period length specified. |

Standard Deviation |
| Returns a standard deviation of dataset m1 with a period length specified. |

Cumulative Sum |
| Calculates an expanding sum using all data from time since up to each datapoint. (See Note 1) |

Cumulative Mean |
| Calculates an expanding mean using all data from time since up to each datapoint. (See Note 1) |

Cumulative Standard Deviation |
| Calculates an expanding standard deviation using all data from time since up to each datapoint. (See Note 1) |

Cumulative Max |
| Returns a cumulative maximum of dataset m1 with a period length specified. |

Percent Change Over Period |
| Returns the percentage change of m1 over the specified period. Values are returned as decimal (i.e. 0.20 indicates +20% growth over the specified 'period'). Note that |

Difference Over Period |
| Returns the absolute value change of m1 over the specified period. Calculated as the difference between each datapoint and data from the specified 'period' in the past. |

Absolute Value |
| Returns the absolute value of all data in m1. |

Power |
| Raises all data in m1 to the specified power 'n'. |

Logarithm |
| Takes the logarithm (base 10) of all data in m1. |

Relative Strength Index |
| Calculates the relative strength index for m1 using the specified input 'period'. |

Range |
| Draws a line from y=0 to y=n, increasing in increments of 1 (where n is the number of datapoints in m1). |

Range (defined start/end) |
| Draws a line from y=start to y=end, changing in increments of (end-start)/n (where n is the number of datapoints in m1). |

Minimum |
| Returns the minimum value of all data in a dataset (or n). |

Maximum |
| Returns the maximum value of all data in a dataset (or n). |

Shift |
| Shifts the dataset right (positive) or left (negative) by the number of timesteps in the defined period. For 1hr resolution data, a period of -24 will shift the data left by 24hrs, where as for 1d resolution data, it would shift it left by 24-days. |

If-Then Condition |
| Establishes an if-then condition comparing the trace of m1 to m2 at each data point, returning the result |

Pearson's Correlation |
| Calculates the Pearson's correlation factor between traces |

Value At |
| Returns the value at a specific date as a horizontal line. |

Subset |
| Returns a subset slice of |

Round |
| Rounds |

Upper |
| Returns the highest value from all input traces at each x-ordinate. |

Lower |
| Returns the lowest value from all input traces at each x-ordinate. |

Drawdown |
| Returns the relative drawdown from the all-time high of |

Mean Return |
| Returns the annualized rolling mean return of |

Realized Volatility |
| Returns the annualized realized volatility of |

Sharpe Ratio |
| Returns the annualized Sharpe ratio of |

Backtest |
| Returns the net asset value (NAV) curve of a trading strategy defined by the trading signal |

Dollar Cost Averaging |
| Returns the net asset value (NAV) curve of the aggregated position in asset |

Dollar Cost Averaging Installments |
| A helper function that simulates daily DCA (dollar cost averaging) installments. The parameters are: a price series |

* Notes*:

Example for cumulative sum/mean/std: the function

`cummean(m1,"2012-01-01")`

at date "2020-01-01" will return a mean of all data from 2012-01-01 to 2020-0-01, but not consider any data after this. These metrics will return zero for all periods prior to defined timestamp "since".Example for

`backtest`

: the function`backtest(m1, if(sma(m1, 20), ">", sma(m1, 50), 1, 0), "2020-01-01", 1000, 0.001)`

simulates the simple moving average cross-over strategy for an investment of $1000 from "2020-01-01" until present. The trading costs are approximated with 0.1% of the volume per trade.Example for

`dca`

:`dca(m1, f1, "2020-01-01")`

with`f1`

defined as`dca_installments(m1, "2020-01-01", 1230, 1000)`

. This simulates the dollar cost averaging of a total investment of $1230 over 1000 days, starting from "2020-01-01".

### Workbench Video Tutorial

This workbench tutorial provides an introduction to the tool, and shows you how to build your first metrics and assess Bitcoin market cycles using Supply Last Active 1yr+.Tutorial Workflow:

Add base metrics and set correct scales and axes.

Convert a Supply from % into BTC Volume.

Calculate a new metric âCoins Younger than 1yr.

Calculate a Supply Net Position Change metric using the diff function.

### Backtesting in Workbench Guide

Discover Workbench's new backtesting suite and take your investment strategy to the next level. Test and compare trading hypotheses, and evaluate risk and performance with metrics like drawdown and Sharpe ratio. Explore basic and advanced trading strategy examples, including on-chain indicators.

Read the full article: http://insights.glassnode.com/backtesting-in-workbench/

Last updated