Skip to content

Instantly share code, notes, and snippets.

View dantonnoriega's full-sized avatar

Danton Noriega-Goodwin dantonnoriega

View GitHub Profile
@dantonnoriega
dantonnoriega / est-tax-etrade-GL-collapsed.md
Last active February 17, 2025 18:47
instructions on how to download gains and losses sheet from etrade and then estimate capital gains tax

Quick Way to Estimate Taxes Owed on Capital Gains (E*Trade)

This short explainer goes through

  1. where to download your Gains and Losses sheet on one E*Trade account.
  2. how to quickly estimate taxes owned.

(1) Downloading Gains & Losses Sheet (G&L_collapsed.xlsx) from E*Trade

@dantonnoriega
dantonnoriega / example_simulated-difference-in-differences.py
Last active April 9, 2024 06:27
A simple example of a difference-in-difference analysis in python using simulated data
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
# Set random seed for reproducibility
np.random.seed(42)
# Generate synthetic data
n_obs = 100
@dantonnoriega
dantonnoriega / get-etf-holdings-data.R
Last active March 4, 2024 19:26
[development] prototype functions to programmatically pull ETF holdings (portfolio) data; likewise which ETFs hold a specific stock and its allocation (data source: etf.com)
# SETUP -----------------
library(httr2)
api_base_url = "https://api-prod.etf.com/private"
hdrs <- list(
`x-limit` = 10000,
`User-Agent` = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Safari/605.1.15',
`Origin` = 'https://www.etf.com',
`Referer` = 'https://www.etf.com/',
`Accept` = '*/*',