# Standard Deviation (volatility)

##
**get_stdev**(*quotes, lookback_periods, sma_periods=None*)

## Parameters

name | type | notes |
---|---|---|

`quotes` |
Iterable[Quote] | Iterable(such as list or an object having `__iter__()` ) of the Quote class or its sub-class. • Need help with pandas.DataFrame? |

`lookback_periods` |
int | Number of periods (`N` ) in the lookback period. Must be greater than 1 to calculate; however we suggest a larger period for statistically appropriate sample size. |

`sma_periods` |
int, Optional | Number of periods in the moving average of `Stdev` . Must be greater than 0, if specified. |

### Historical quotes requirements

You must have at least `N`

periods of `quotes`

to cover the warmup periods.

`quotes`

is an `Iterable[Quote]`

collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.

## Return

```
StdevResults[StdevResult]
```

- This method returns a time series of all available indicator values for the
`quotes`

provided. -
`StdevResults`

is just a list of`StdevResult`

. - It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first
`N-1`

periods will have`None`

values since there’s not enough data to calculate.

### StdevResult

name | type | notes |
---|---|---|

`date` |
datetime | Date |

`stdev` |
float, Optional | Standard Deviation of Close price over `N` lookback periods |

`mean` |
float, Optional | Mean value of Close price over `N` lookback periods |

`z_score` |
float, Optional | Z-Score of current Close price (number of standard deviations from mean) |

`stdev_sma` |
float, Optional | Moving average (SMA) of STDDEV based on `sma_periods` periods, if specified |

### Utilities

See Utilities and Helpers for more information.

## Example

```
from stock_indicators import indicators
# This method is NOT a part of the library.
quotes = get_history_from_feed("SPY")
# Calculate 10-period Standard Deviation
results = indicators.get_stdev(quotes, 10)
```

## About Standard Deviation (volatility)

Standard Deviation of Close price over a rolling lookback window. Also known as Historical Volatility (HV). [Discuss]