Forked from PyDataBlog/rolling mean and volatility.py
Created
April 13, 2020 20:27
-
-
Save Sandy4321/8cb638230aaf5776573dabbb9a2e7953 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bitcoin = cryptos[0] | |
bitcoin_cash = cryptos[1] | |
dash = cryptos[2] | |
ethereum_classic = cryptos[3] | |
bitconnect = cryptos[4] | |
litecoin = cryptos[5] | |
monero = cryptos[6] | |
nem = cryptos[7] | |
neo = cryptos[8] | |
numeraire = cryptos[9] | |
omisego = cryptos[10] | |
qtum = cryptos[11] | |
ripple = cryptos[12] | |
stratis = cryptos[13] | |
waves = cryptos[14] | |
dataset = [bitcoin, bitcoin_cash, dash, | |
ethereum_classic, bitconnect, | |
litecoin, monero, nem, neo, | |
numeraire, omisego, qtum, | |
ripple,stratis, waves] | |
for item in dataset: | |
item.sort_index(inplace=True) | |
item['30_day_mean'] = item['Close'].rolling(window=20).mean() | |
item['30_day_volatility'] = item['Close'].rolling(window=20).std() | |
for item in dataset: | |
print (item.columns) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment