-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvolatility_inidicators.py
68 lines (45 loc) · 1.35 KB
/
volatility_inidicators.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 6 22:16:48 2020
@author: Benjamin Lee
"""
import pandas as pd
import yfinance as yf
import datetime
import numpy as np
import matplotlib.pyplot as plt
import utils
from scipy import stats
class volatility_indicators:
def __init__(self, data):
self.data = data
# Bollinger Ban
def bb(self):
'''
Bollinger Bands
Volatility bands placed above and below a moving average based on standard deviations
Volatility UP: Wider
Volatility DOWN: Contract
ref: https://school.stockcharts.com/doku.php?id=technical_indicators:bollinger_bands
'''
def dc(self):
'''
Donchian Channel
'''
def ui(self):
'''
Ulcer Index
'''
def kc(self):
'''
Keltner Channel
'''
def atr(self):
'''
Average True Range
ref: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_atr
'''
if __name__ == "__main__":
# Download Stock Data
spy = yf.download('SPY', '1990-01-01')
vi = volatility_indicators(spy)