> For the complete documentation index, see [llms.txt](https://docs.rasgoml.com/rasgo-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rasgoml.com/rasgo-docs/rasgo-0.1/all-transforms/moving_avg.md).

# Moving Avg

generates moving averages per column and per window size

## Parameters

| Name           | Type         | Description                                                                | Is Optional |
| -------------- | ------------ | -------------------------------------------------------------------------- | ----------- |
| input\_columns | column\_list | names of column(s) you want to moving average                              |             |
| window\_sizes  | int\_list    | the integer values for window sizes you want to use in your moving average |             |
| order\_by      | column\_list | columns to order by, typically the date index of the table                 |             |
| partition      | column\_list | columns to partition the moving average by                                 |             |

## Example

```python
ds = rasgo.get.dataset(id)

ds2 = ds.moving_avg(input_columns=['OPEN','CLOSE','HIGH','LOW'], window_sizes=[1,2,3,7], order_by=['DATE, 'TICKER'], partition=['TICKER'])
ds2.preview()
```

## Source Code

{% embed url="<https://github.com/rasgointelligence/RasgoTransforms/blob/main/rasgotransforms/rasgotransforms/transforms/moving_avg/moving_avg.sql>" %}
