Bloomberg Query Language (BQL) Function Notes

Arithmetic Functions

  • abs(): Returns the absolute value of a number.

  • ceil(): Rounds up to the nearest whole number.

  • exp(): Returns e raised to a specified value.

  • floor(): Rounds down to the nearest whole number.

  • ln(): Calculates the natural logarithm of a number.

  • log(): Computes the base 10 logarithm.

  • round(): Rounds a number to a specified precision.

  • sign(): Returns the sign of an integer (-1 for negative, 0 for zero, +1 for positive).

  • sqrt(): Calculates the square root of a number.

  • square(): Computes the square of a number.

  • mod(): Returns the modulus (remainder) of a division between two numbers.

  • negation(): Returns the negative value.

  • pow(): Raises a number to the nth power.

  • normal_dist(): Calculates the normal (cumulative) distribution.

  • normal_inv(): Calculates the inverse of the normal (cumulative) distribution.


Statistical Functions

  • sum(): Computes the sum of all values in a dataset.

  • count(): Counts all non-null values in a dataset.

  • avg(): Calculates the average (mean) of values.

  • wAvg(): Calculates the weighted average of values.

  • min(): Returns the lowest value in a dataset.

  • max(): Returns the highest value in a dataset.

  • median(): Returns the median value in a dataset.

  • product(): Calculates the product of all values.

  • corr(): Computes the correlation coefficient between two dataset variables.

  • rsq(): Calculates the r-squared value of a regression model.

  • std(): Computes the standard deviation of values in a dataset.

  • var(): Calculates the variance of values.

  • skew(): Returns the skewness of a distribution.

  • kurt(): Calculates the kurtosis of a distribution.

  • zScore(): Computes the z-score for a data point in relation to its dataset.

  • winsorize(): Limits outlying data under specific thresholds.

  • compoundGrowthRate(): Calculates the geometric average growth rate of a value.

  • cut(): Calculates quantile boundaries in a dataset.

  • rank(): Ranks values in a dataset either in descending or ascending order.


Grouping Data Functions

  • group(): Groups data for statistical analysis across defined security boundaries.

  • ungroup(): Projects grouped data back onto the original security count.

  • groupAvg(): Returns the average across group categories.

  • groupCount(): Counts non-null entries across groups.

  • groupMax(): Returns the maximum value across groups.

  • groupMedian(): Returns the median value across groups.

  • groupMin(): Provides the minimum value of group entries.

  • groupRank(): Ranks values dynamically within groups.

  • groupStd(): Computes standard deviation across groupings.

  • groupSum(): Sums values for specified groups.

  • groupWAvg(): Computes weighted average for groups.

  • groupZscore(): Calculates z-scores in the grouped context.

  • groupcut(): Segments data into quantiles within groups.

  • groupwinsorize(): Winsorizes data to mitigate the impact of outliers by groups.


Time Series Manipulation Functions

  • cumAvg(): Computes cumulative average of values over time.

  • cumMax(): Tracks the cumulative maximum across a series.

  • cumMin(): Maintains a record of cumulative minimum values within a timeframe.

  • cumProd(): Calculates cumulative product of a series of values.

  • cumSum(): Accounts for cumulative sum across values over time.

  • diff(): Computes the difference between current and previous values in a series.

  • net_chg(): Determines the net change in values over time.

  • pct_chg(): Computes percentage change between current and previous instances.

  • pct_diff(): Measures percentage difference between two distinct values.

  • rolling(): Evaluates expressions on a rolling date range basis.


Filtering and Conditionals Functions

  • filter(): Screens subsets within datasets based on criteria.

  • if(): Evaluates predicates to output designated values based on conditions.

  • and() / or(): Logical operators for boolean conditions.

  • equals() / notEquals(): Compares two values for match or mismatch.

  • greaterThan() / lessThan(): Determines inequality between values.

  • between(): Checks if values fall within specified ranges.

  • matches(): Finds values based on criteria across datasets.