Skip to content

Instantly share code, notes, and snippets.

View pjhoberman's full-sized avatar

PJ Hoberman pjhoberman

  • Denver, Colorado
View GitHub Profile

Hi everyone

tl;dr Is this ETF project worthwhile, of interest, useful, or should I shelve it and move on with my life?

A while ago, I was looking at some ETFs I own and wondering why they moved up or down that day. I understand that market fluctuations will do that, but I also assumed the underlying assets likely moved in some significant manner. So, I started looking at the underlying stocks to find correlations and had trouble finding a programmatic way to find what an ETF holds. While the data is freely available on brokerage sites and the ETF fund itself (in excel format, normally), I didn't find any reasonable way to get this info via api, at least not that I could afford.

@pjhoberman
pjhoberman / day1.1.py
Last active December 7, 2021 15:37
Advent of Code 2021
inp = """199
200
208
210
200
207
240
269
260
263"""
def mask_val(mask, val):
val = format(val, "#038b")[2:]
new_val = ""
for pair in zip(val, mask):
if pair[1] != "X":
new_val += pair[1]
else:
new_val += pair[0]
return int(new_val, 2)
with open('data.txt') as file:
data = file.read().splitlines()
# part 1
DIRECTIONS = {
0: 'N',
90: 'E',
180: 'S',
270: 'W',
from collections import Counter
# part 1
with open('scratch_28.txt') as file:
data = file.read().splitlines()
def get_adjacent_seats(row, col, _data):
previous_row = None
next_row = None
previous_col = None
from collections import Counter
with open('data.txt') as file:
data = file.read().splitlines()
def get_adjacent_seats(row, col, _data):
previous_row = None
next_row = None
previous_col = None
next_col = None
[
{
"url": "https://www.yogajournal.com/.image/MTQ2MTgwNjcyNDg2Mzg1MDg1/leah-cullis-in-garland-pose.jpg",
"path": "2015/12/",
"filename": "leah-cullis-in-garland-pose.jpg",
"ref_ids": [
"ci02075690900a25bd"
]
},
{
from itertools import permutations
with open('scratch_23.txt') as file:
nums = file.read().splitlines()
nums = [int(nums) for nums in nums]
def check_number(numbers, preamble=25, start=0):
pre = numbers[start:preamble+start]
test = numbers[preamble+start]
perms = permutations(pre, 2)
with open('input.txt') as file:
instructions = file.read().splitlines()
used = []
idx = 0
acc = 0
while idx not in used:
used.append(idx)
op, arg = instructions[idx].split()
if op == "nop":
import re
from collections import defaultdict
from copy import deepcopy
with open('/Users/pjhoberman/Library/Application Support/JetBrains/PyCharm2020.2/scratches/scratch_21.txt') as file:
data = file.read()
rules = data.splitlines()
parse_re = r"(\w+ \w+) bags contain (.*)"