Skip to content

Instantly share code, notes, and snippets.

View scubamut's full-sized avatar

scubamut

  • Individual
  • Johannesburg and London
View GitHub Profile
#########################################################################
# US_stock_bundle
###############
# ~.zipline/extensions.py
#from zipline.data.bundles import register, US_stock_data
#
#register('US_stock_bundle', US_stock_data.US_stock_data, calendar_name='NYSE')
# to ingest the etfs
import zipline
from zipline.data.bundles.core import register, ingest
import yfinance as yf
import pandas as pd
from datetime import datetime
import pytz
# FOR ALL ASSETS
import sys
if 'ziptrader36' in sys.path[1]:
active_kernel = 'ziptrader36'
elif 'zipline-reloaded' in sys.path[1]:
active_kernel = 'zipline-reloaded'
else:
active_kernel = 'not ziptrader36 or zipline-reloaded'
@scubamut
scubamut / vscode_shortcuts.md
Created June 9, 2020 14:44 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

import talib
# routine to get args required for talib function
def find_talib_args(func):
s = eval('talib.' + func + '.__doc__')
try:
s = s.splitlines()[0].split('(')[1].split(')')[0].replace('[','').replace(']','').replace('?','')
return s.split(',')
except:
from fintools import endpoints
# end_points prices (in this case, monthly)
end_points = endpoints(period='M', trading_days=prices_d.index)
prices_m = prices_d.loc[end_points]
prices_m[:2]
etfs = [
# ----------------------------------------- #
# SPDRS/State Street Global Advisors (SSGA)
'XLY', # Select SPDR U.S. Consumer Discretionary
'XLP', # Select SPDR U.S. Consumer Staples
'XLE', # Select SPDR U.S. Energy
'XLF', # Select SPDR U.S. Financials
'XLV', # Select SPDR U.S. Healthcare
'XLI', # Select SPDR U.S. Industrials
'XLB', # Select SPDR U.S. Materials
import matplotlib.pylab as plt
plt.rc('figure', figsize=(8, 5))
plt.style.use('seaborn-dark')
import pandas_datareader.data as pdr
import matplotlib.pyplot as plt
import pandas as pd
from datetime import datetime, timezone
import pytz
import talib
import itable
import ffn
from fintools import get_DataArray,compute_weights_RS_DM,compute_weights_PMA,\
import pandas_datareader.data as pdr
import matplotlib.pyplot as plt
import pandas as pd
from datetime import datetime, timezone
import pytz
import talib
import itable
import ffn
from fintools import get_DataArray,compute_weights_RS_DM,compute_weights_PMA,\