Skip to content

SQL – Data management

The database is maintained in a SQL Server database. Here we share a few a few useful function that can be used to analyze the data, if using SQL server or other similar tool.

Correlation Calculation – Here you will find how to calculate Pearson correlation for two different return streams.

End of Month – A function that turns any date into an end of month date. Useful for aggregations or date transformations.

OLS Regression – Performs Ordinary Least Squares (OLS) regression using SQL.

Exponential Moving Average – How to calculate an exponential moving average in SQL from a time series.

Performance Table – Example how to create a nicely formatted 14 column performance table, using the PIVOT command in T-SQL.