Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
"""
Created on Fri Sep 2 13:26:48 2016
@author: Brian Christopher, CFA [Blackarbs LLC]
"""
import time
import pandas as pd
import numpy as np
@BlackArbsCEO
BlackArbsCEO / BlackArbs_ETF_Macro Valuation_SPDR_4112015
Last active February 6, 2018 14:40
BlackArbs Macro Valuation tool_ Implied Cost of Capital, risk, return
{"metadata": {"language_info": {"mimetype": "text/x-python", "codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "name": "python", "pygments_lexer": "ipython3", "version": "3.4.3", "nbconvert_exporter": "python"}, "kernelspec": {"name": "python3", "language": "python", "display_name": "Python 3"}}, "cells": [{"source": "###**BlackArbs LLC Independent Research**", "cell_type": "markdown", "metadata": {}}, {"source": "\n####SPDR ETF Composite Sector Valuation [Saturday 4.11.2015]\n------------\n\nThe following Ipython Notebook examines the **Implied Cost of Capital (ICC)** method of valuation for purposes of trade/portfolio positioning. The goal is to identify asymmetric investing opportunities due to incongruence between *'recent'* historical valuations and forward looking expectations of earnings growth. \n\nI will attempt to accomplish the goal by first examining composite returns based on ETF category groupings. Then I will compare the historical data vs the forward looking **ICC*
'''
Netfonds import 5 days of intraday data
'''
import numpy as np
import pandas as p
from pandas.tseries.offsets import *
import datetime as dt
import matplotlib.pyplot as plt
size = (14,10)
@BlackArbsCEO
BlackArbsCEO / NFL QB Analysis_Wins vs TD_Int Ratio.ipynb
Last active November 26, 2018 16:12
Simple Linear Regression comparing NFL Quarterback Win Percentage vs. Touchdown to Interception ratio using data collected from Pro-football-reference.com
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import sys
import pandas as pd
import pandas_datareader.data as web
import numpy as np
import time
import asyncio
from fake_useragent import UserAgent
'''set path variables'''
project_dir = "YOUR/PROJECT/DIR"
import pandas as pd
import numpy as np
import re
# ================================================
class option_parser:
def __init__(self, symbol, response):
self.symbol = symbol
self.response = response
# ------------------------------------------------
import asyncio
import aiohttp
# ================================================
# for first run only
class first_async_scraper:
def __init__(self):
pass
async def _fetch(self, symbol, url, session, headers):
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 2 13:23:34 2016
@author: Brian Christopher, CFA [Blackarbs LLC]
"""
import pandas as pd
from more_itertools import unique_everseen
import requests
@BlackArbsCEO
BlackArbsCEO / Free_Intraday_StockData_Test_BarChart_API_Gist.py
Created September 22, 2015 19:48
Example code from 'Get Free Intraday Stock Data With Python and BarChart OnDemand API' blog post.
# -*- coding: utf-8 -*-
import time
t0 = time.clock()
import pandas as pd
from pandas.tseries.offsets import BDay
import numpy as np
import datetime as dt
from copy import copy