This file contains 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
| Name | Time | Deaths | | |
|---------------|--------------|------------------------------| | |
| Spanish Flu | 1918-1919 | 40-50M | | |
| Asian Flu | 1957-1958 | 1.1M | | |
| Hong Kong Flu | 1968-1970 | 1M | | |
| HIV/AIDS | 1981-present | 25-35M | | |
| Swine Flu | 2009-2010 | 200,000 | | |
| SARS | 2002-2003 | 770 | | |
| Ebola | 2014-2016 | 11,000 | | |
| MERS | 2015-present | 912 | |
This file contains 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
strats = ['returns'] # 19 | |
for col in cols: # 20 | |
strat = 'strategy_%s' % col.split('_')[1] # 21 | |
df[strat] = df[col].shift(1) * df['returns'] # 22 | |
strats.append(strat) # 23 | |
df[strats].dropna().cumsum().apply(np.exp).plot() # 24 |
This file contains 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
df['returns'] = np.log(df['closeAsk'] / df['closeAsk'].shift(1)) # 12 | |
cols = [] # 13 | |
for momentum in [15, 30, 60, 120]: # 14 | |
col = 'position_%s' % momentum # 15 | |
df[col] = np.sign(df['returns'].rolling(momentum).mean()) # 16 | |
cols.append(col) # 17 |
This file contains 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
data = oanda.get_history(instrument='EUR_USD', # our instrument | |
start='2016-12-08', # start data | |
end='2016-12-10', # end date | |
granularity='M1') # minute bars # 7 |
This file contains 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
import pandas as pd # get your dependencies | |
df = pd.read_csv(‘example.csv’) # read the data | |
df.head(1) # look at the data and make sure you’re changing the right column | |
df.rename(columns={'oldName': 'newName'}, inplace=True) # rename the column |