Blog

Writing, notes, and assorted ramblings

This is the chronological archive. Use the filters if you're looking for a particular rabbit hole.

118 posts

The Libertarian Case for Decentralized Energy — and My Votes in the SRP Election

If you can vote in this election, request a ballot. The deadline is March 27. Election Day is April 7. Eligible landowners can vote by mail or in person. Most people who can vote...

YouTube Videos to MP3 and Transcription

I find myself listening to videos on YouTube quite frequently where it would be nice to dump them into an MP3 and take them on the road. This script will do exactly that. I also...

Analyzing Any Polymarket User’s Trades Using Polygon

Polymarket.com, a prediction market platform, operates on the Ethereum blockchain through the Polygon network, making it possible to analyze user transactions directly from the...

Arbitrage in Polymarket.com

About a month ago, I noticed some arbitrage opportunities on Polymarket.com. However, the liquidity on the platform isn't significant enough for me to pursue this further. I'm...

Degenerate Gambling on Polymarket.com: Picking Up Pennies in Front of a Steamroller… for a 12.09% Yield?

Recently, I placed a bet on Polymarket.com, speculating that Kamala Harris and JD Vance will not debate before the upcoming election. With just 60 days left, the odds looked...

Degenerate Gambler or Investor? Analyzing Polymarket’s “Will Apple Remain the Largest Company” Bet

I've spent the last couple of weeks shifting my focus toward finding arbitrage opportunities in the betting markets. Today, I came across an intriguing bet on Polymarket: “Will...

Exploiting Arbitrage – Betting Against Nate Silver for a 54% Yield

I'm always on the hunt for an edge in the markets. After finishing Nate Silver's book, "On the Edge: The Art of Risking Everything." this week I thought it would be fitting to...

Generating API keys for Polymarket.com

Here is a quick tutorial on how to generate API Key, Secret, and Passphrase to Polymarket.com. This way you can start trading using Python and skip the web interface. keys.env The...

Accessing Polymarket.com Data in Python

Recently I started exploring arbitrage opportunities in the Polymarket.com world. I quickly realized I would need faster access to the data. So I wrote some Python programs to...

Unconventional Success: A Fundamental Approach to Personal Investment by David F. Swensen

I've had Unconventional Success by David F. Swensen on my shelf for five years, but it took me a while to finish. The book is somewhat dense and challenging, yet it offers...

Building a DIY Powerwall to offset peak demand cost PT3, install

I finally installed this EG4 battery and inverter to power my house. You can read parts 1 and 2 here if you're curious why I started this project. I did end up purchasing two...

Building a DIY Powerwall to offset peak demand cost PT2, sizing the battery

In the first part of this series, we discussed why building a DIY Powerwall is a smart move to offset peak demand costs. In this part, we'll focus on how to determine the...

Building a DIY Powerwall to offset peak demand cost PT1, why?

Recently, I decided to embark on a DIY Powerwall project for my house. The first challenge I faced was determining the appropriate size for the system. Living in Arizona, where...

Automating notification updates on court cases for Maricopa County Superior Court

Recently, I needed real-time updates for a court case affecting a house I was purchasing. Instead of constantly checking the case manually, I wrote a Python script to automate...

Automating FinCEN Beneficial Ownership Information Reporting for Multiple Organizations

The Financial Crimes Enforcement Network (FinCEN) now requires most businesses to report their beneficial owners, a mandate stemming from the U. S. Corporate Transparency Act. The...

A Deep Dive into Intraday Trading Costs with Python, Alpaca’s API, and SIP Data

In the realm of intraday trading, managing and minimizing trading costs is not just a practice; it's a necessity. A strategy that seems profitable on paper can quickly become a...

Houses over $1M in Arizona are selling at their fastest pace, ever.

Today, I dove into housing data and decided to filter houses based on price to determine how it impacted sales numbers. The graph below illustrates Listings Under Contract up...

How to Buy Gold for Less Than Spot

You may have heard recently Costco decided to start selling gold bars and coins. Here's how you can get them at less than spot value. Today I logged in to Costco.com. You can see...

Python and yfinance: Free Fundamental Data for Algorithmic Trading

Fundamental data offers a plethora of data points about a company's financial health and market position. I want to share a streamlined approach to accessing and storing...

Snagging Gold and Silver from Costco.com with Python

If you're keen on diversifying your investment portfolio with precious metals in physical form, you probably always look for the best deals and try to avoid broker fees....

Hedge Fund Market Wizards by Jack D. Schwager Custom GPT

If you read a lot of technical books or want to specifically reference them in the future, then you need to check out ChatGPT's custom GPT creator. I'm going to show an example of...

How I Built a Custom GPT to Interpret and Answer Questions About my HOA Governing Documents

Exploring the realm of custom GPTs opens up a world of possibilities that you might not be aware of yet. For those who haven't dived into this feature, you're truly missing out on...

Arizona Real Estate Update Februrary 2024

Arizona real estate has been pretty flat for a while so I haven't posted any updates. But there are a few interesting things I noticed this week. Median prices have already...

Berkshire Hathaway Annual Shareholder Letter PDF and MP3

BERKSHIRE HATHAWAY INC. Shareholder Letter 2023 MP3Download BERKSHIRE HATHAWAY INC. Shareholder Letter 2023 PDFDownload

Soaring Inflation and Stable Unemployment Will Stop the FED from Cutting Rates

The question of when the Federal Reserve will cut interest rates is at the forefront of many investors' and minds. Given the current economic indicators and futures market trends...

Extracting text from a PDF using OCR, Python, and Google Colab for free

If you've ever downloaded a scanned PDF and tried to search it you'll quickly realize this isn't possible. Here is how you can use Python to extract the text from and PDF file and...

Machine Learning for Algorithmic Trading: Predictive models to extract signals from market and alternative data for systematic trading strategies with Python GPT

One of my favorite books for quantitative investing is Machine Learning for Algorithmic Trading. However, a lot of these concepts might be difficult for someone who getting...

Automating 1099 statements from TreasuryDirect.gov

Ok, so Ibonds had a huge rate of return last year. Perhaps you're like me and you created.. a few hundred accounts. Well, now you have a major problem. You need to get your 1099...

Mortgage Rates on Hold? Latest FED Futures Flip Forecast for March

Fed Futures have indicated a change in the wind regarding the Federal Reserve's upcoming policy decisions. While everyone was anticipating rate cuts for the March meeting now seem...

Modifying PyFolio to output to HTML

Recently I was following a paper and in the example they used Pyfolio which is an awesome performance and risk analysis library in Python developed by Quantopian Inc when they...

Mortgage Demand Surges!… Huh?

It's interesting to see people reposting this story, "Mortgage demand surges!" Talk about abusing statistics. This headline is based on mortgage applications which is a...

Pyfolio – AttributeError: ‘Series’ object has no attribute ‘iteritems’ & AttributeError: ‘numpy.int64’ object has no attribute ‘to_pydatetime’

Recently I was following a paper and in the example they used Pyfolio which is an awesome performance and risk analysis library in Python developed by Quantopian Inc when they...

Using Simple Multiple Linear Regression Models to Estimate Missing Data

Occasionally I will want to see long-term historical data so I can better interpret the history of something I'm trying to analyze. I wrote some code a while back that analyzes...

Credit Card Arbitrage: Turning a 0% APR Offer into $2,000 in Free Cash

The Offer American Express extended a 0% APR credit card offer to me, valid for 12 months. This card isn't just about the interest-free period; it also offers approximately 5%...

Maximizing Cash Returns in a Rising Rate Environment

In this time of rising Fed rates, it's a good time to explore the best spots for your cash. To give you a hand, I've compiled some auto-updating options. To summarize: For easy...

My Leaky Water Bill – How to Use Machine Learning to Detect Water Leaks

Recently, I encountered an unexpected challenge: a water leak beneath the slab of my house. The ordeal had me up until 1 AM, rerouting the line through my attic with PEX piping....

What is an HDF5 File? A Deep Dive into Hierarchical Data Format

Introduction If you've spent any time working with large datasets, especially in scientific computing, machine learning, or finance, you've probably come across HDF5 files. But...

Predicting Stock Prices and Corporate Financials Ratios with Facebook Prophet Using Python

I started off wanting to analyze the sustainability of mortgage buydowns by home builders. But as it happens, my ADHD had other plans. Three weeks later, here we are with code...

Using Python to save corporate financial data locally from EODHD

In a previous post, I showed how to store symbol data from EODHD. The purpose of this code is to now iterate through all those symbols and grab the corporate financial data from...

How to Store Stock Market Data Locally with Python: A Step-by-Step Guide to Saving OHLCV Data from EODHD

In a previous post, I showed how to store symbol data from EODHD. The purpose of this code is to now iterate through all those symbols and grab the Open, High, Low, Close...

Storing Stock Market Indices and Symbols with EODHD

If you're looking to perform complex analyses, backtests, or even develop your own trading algorithms you're going to need access to good data. What I'm going to show you today is...

Why Housing Prices are Unsustainable

Understanding trends in housing affordability provides crucial insights into financial stability and economic conditions. A key metric to consider is the...

Housing Affordability Analysis Using Python

Housing affordability is a critical issue that affects millions of individuals and families. Understanding trends in housing affordability can provide insights into financial...

Analyzing the FED Raising/Lowering rates impact on S&P and Housing Prices

I wanted to analyze the relationship between the Federal Reserve's (Fed) raising or lowering of interest rates and its impact on the S&P 500 and the median house price. I wrote...

Republish Alpaca trades, quotes, and bars using Redis

Like many brokers, you don't get to make unlimited connections to the Alpaca API. What I'm going to set up today is Redis to redistribute Alpaca trades, quotes, and bars data. The...

A Python Based Alpaca Template to Process Real-time Market Data

The world of finance and trading has seen a massive surge in the use of technology and data. With the increasing availability of APIs and data streams, it has become essential for...

Getting Started with InteractiveBrokers TWS API

This is a simple tutorial on how to get started with TWS API from Interactive Brokers and subscribe to a few test symbols to get stock updates in Ubuntu. You need to first install...

Analysis of House Prices and Interest Rates: The Path to Equilibrium Using Python and FRED

There is always discussion surrounding the trajectory of house prices. At the core of these debates lies the principle of consumer affordability, which is heavily influenced by...

Automating the Management of Hundreds of TreasuryDirect.gov accounts

If you manage multiple accounts through TreasuryDirect.gov to purchase T-bills, T-notes, T-bonds, TIPS, FRNs, or C of I certificates then you know how antiquated and difficult it...

Evaluating Optimization Algorithms for Ornstein-Uhlenbeck with Synthetic Data: A Comparison of Accuracy and Speed

In the realm of algorithm analysis, it is easy to become preoccupied with testing on actual datasets where variables remain unknown. However, to assess algorithms for speed and...

Mean Absolute Relative Difference Error (MARDE) Metric for Improved Forecasting Evaluation

I was running some machine learning models and was struggling to find a metric that could capture errors relative to volatility in the underlying model that I was trying to...

How We Just Got Fucked by the Banking Elite and the FED… Again

As the Federal Reserve recently bailed out the wealthy bankers once again, the Bank Term Funding (BTFP) has been pushing the Fed's balance sheet up from $8,342T on March 8 to...

Chat with Traders – John Grady

Good episode on trading the order book and scalping treasuries with John Grady. Here's the Youtube video he references on his trading. Here is his Twitter feed. Tweets by...

Convert PDF to MP3 free using Python and Google Colab

If you're like me sometimes you'll have a PDF file that you want to listen to passively while you're doing something else. Here's some Python code I put together to convert a PDF...

Extract JPG frames from MP4 files using Python and Google Colab

I'm working on creating some 3d models of properties that I'm interested in purchasing. In order to do this I need a bunch of JPG files to import them into Open Drone Map. This...

Arizona Real Estate October 2022

The real estate market hasn't only cooled but it appears to be pretty frozen. What I'm looking at is the contract ratio. This essentially is the number of houses under contract...

Only 15 days left for 9.62% I-bonds

The new CPI report came out today. at a.43% monthly increase. This means I-bonds starting November first will only yield 6.472% October 28th is the last day to purchase I-bonds at...

You house isn’t worth what you think it is.

As I look over the real estate numbers in Arizona this week, I noticed that people are asking on average about 15% more than what houses sell for. In fact, we had 4,427 price cuts...

House prices may have peaked in May but mortgage payments are still at all time highs

The real estate market continues to get wrecked by the FED rate increases. From a valuation perspective. But most people I would argue don't care about the price of a house as...

Arizona Real Estate update 8.8.2022

Price cuts last week just went to their highest level in years. This is a horrible sign for things to come in Arizona. But it gets worse... Active weekly listings are also at...

Arizona Real Estate update 8.8.2022

Six months ago some had the opinion, 'this time is different. Their primary argument was that supply didn't exist so housing prices could not fall that significantly. I always...

Arizona Real Estate update 8.1.22

People are still slashing their listing prices. It increased to its highest level this week, 4,172. This will continue to put huge downward pressure on prices. We have exactly 3...

Arizona real estate weekly update 7.25.22

Call me crazy... But I believe affordability is the primary driver of housing prices. Mortgage rates determine payment. And payment determines affordability. This is rough rough...

Arizona real estate weekly update 7.18.22

Price cuts continue to accelerate. Sellers are panicking. Typical at the top of a bull run. This is not good for housing prices. Inventory and months of supply are back to Jun...

I Bonds don’t yield 9.62% – It’s actually 10.49%

The publicly advertised rate for I Bonds according to the Treasury Direct website is 9.62% if they were or are purchased between May and October of 2022. But what people do not...

Arizona real estate weekly update 7.7.2022

My Cromford access has been restored. I can now bore you with housing statistics. The Fed will burn down everything until they get inflation under control, no asset is safe. From...

AZ Home sellers are panicking

I'm fixated on this chart. I always used to underestimate the psychological aspect of investing. But it plays an important role in any tradable asset. This chart represents the...

Finally unloaded my rentals

The Fed is deathly afraid of inflation. At the beginning of the year, they announced they would unwind QE and raise interest rates. This was a clear sign to me that it was time to...

How SRP is destroying rooftop solar with demand charges

If you've installed solar and you live within the monopoly of SRP then you know what kind of racket they are running over there. You spend tens of thousands of dollars to do your...

Installing Zipline on Colab

If you're using Zipline for portfolio analysis you may be wondering how to get it installed in Google Colab which is running Ubuntu 18.04. Here are the commands.!wget...

We need solar to diversify our energy imports away from countries like Russia so let’s choose our SRP leaders wisely

This week has been an emotional one. We welcomed our new baby, Olivia, to the world on 3/1/22. It's hard to not be extremely grateful, emotional, and realize how lucky we are when...

Opening Github IPYNB files in Google Colab

If you ever want to open a Jupyter notebook that you're reading in Github you can simply replace the URL from github.com to colab.research.google.com/github and the rest of the...

Saving your Audible books to MP3 using Python, Colab, and AAXtoMP3

If you're like me and you don't like having your audiobooks tied up in Audible. There is a way to convert them to MP3. I wrote some Python code in Google Colab to show this...

Lords of Easy Money and Thomas Hoenig

The FED's decisions affect every asset you own all the way down to the cost of your everyday grocery purchases. I highly recommend Lords of Easy Money by Christoper Leonard. I...

Share of real estate ownership broken down by centile

I was doing some analysis of the effects of quantitative easing and asset purchases by the FED. Ran across this data of historical ownership of real estate by wealth percentiles.

Retrieving historical data from FRED or Yahoo Finance using Python

If you spend a lot of time analyzing big data then data retrieval is paramount. I've written some Python code that I use daily to retrieve data from Federal Reserve Bank of St....

Do the poor own stocks?

I'm sitting here doing some completely unrelated research and I stumbled across this figure which I've seen multiple times in the past. It has always surprised me. As the markets...

What’s a better investment stocks or real estate? Let’s write some Python code.

I was recently chatting with a buddy about investing in real estate or stocks and which was better. I decided to use Python to analyze what that investment would look like. I used...

ValueError: cannot set WRITEABLE flag to True of this array

If you're getting this error when trying to read a simple.h5 file. Change your code when you originally create the.h5 file to specify format='table' This should resolve the issue....

Get thousands in repair costs if your vehicle was damaged on the US60 back in November

If you're like me and live east of the US60 there is a good chance you were driving home one random day in November only to be hit with a barrage of rocks and other asphalt...

The annoyance of Arizona politicians endlessly bashing California to pander to Arizona citizens

I'm reading this article tonight on the Wall Street Journal where Mark Brvnovich ignorantly tries to bash California in an attempt to somehow boost his own *accomplishments. He...

Send SMS alerts from your trading algorithms in Python

Occasionally there may be some important alerts that you want your trading algorithms to send to you that require immediate attention. One that I use frequently is daily account...

Setting up Python algos to run on Ubuntu startup using systemd

If you're running your trading algorithms on Linux the best way to get them to start on bootup is to use a service called systemd. Here are the steps on setting that up. Go to...

Setting up Python algos to run on Ubuntu startup using crontab

If you're using Ubuntu or some other flavor of Linux you more than likely want your algorithm to start with the server. This is a pretty straightforward process. The first thing...

Earn 7.12% on money sitting in your checking or savings account and hedge against inflation, risk-free, here’s how.

If you're like me you probably have money sitting in your checking, savings, or money-market account. Paying practically zero interest and getting eaten alive by inflation. Here's...

Used car as an investment?

With inflation running rampant you could actually justify the purchase of a used car as an investment... Crazy when you think about it....

How to enable Python API in Interactive Brokers Trader Workstation

You're going to want to open Interactive Brokers trader workstation as normal. Then head over to edit>Global Configuration and check that first box. Enable ActiveX and Socket...

Shorting stocks to protect your home’s equity without selling your house

Almost everyone in the United States who owns a home has seen a massive increase in the equity of their house. In the Phoenix metro area, we have seen massive gains. For instance...

Delta Variant is Coming and I’m not Concerned.

If you look at the cases of the Delta variant of Covid coming out of the UK it looks alarming and it appears we're getting ready to get another wave of Covid to shut down the...

Are we living in a simulation?

I was reading this article today from the Wall Street Journal - Brain Implant Lets Man ‘Speak’ After Being Silent for More Than a Decade(Original article from the New England...

Finding the Next Gamestop or AMC

As we see the surge of meme stocks like [stock_quote symbol="AMC" show="symbol"] or [stock_quote symbol="GME" show="symbol"] you might be wondering how you can profit and get the...

Machine Learning for Algorithmic Trading: Predictive models to extract signals from market and alternative data for systematic trading strategies with Python, 2nd Edition

This is an awesome book.

Great time on my buddy JP’s podcast

https://open.spotify.com/episode/3524q7rmEKV5YcUOKFrKd4?si=va7jP1NJQ3SM-CVAbPw5Rw

Closing SLV trade – 121% in ~10 months

Last year during Covid I decided to purchase some silver options. 4/20/202025925191587Bought SLV Jan 21 2022 15.0 Call @ 3.254/20/202025925192864Bought SLV Jan 21 2022 15.0 Call @...

Closing ULTHF trade 17.8% – 13 days

You can read about my previous post on this short position here. This stock has returned to its normal volatility and I'm up 17.8% in about two weeks. I'm happy with this trade. I...

Statistical Arbitrage in Pairs Based Trading

I was discussing principal component analysis and eigenvalues with a friend today. If you're not familiar with stat arb in the pairs-based trading world this paper is a good read.

Why I’m shorting ULTHF

I woke up to this text message yesterday. It was completely unsolicited and I have no idea what the source of it is. Could it be a potential pump and dump given the current market...

The world’s largest short squeeze tomorrow? My 2020 trade already up 193% should benefit heavily.

Last year I was looking to up my precious metal holdings. I like to keep 10% of my net worth in gold and 1% in silver. I bumped my gold holdings to 20% given the Coronavirus...

Want $300 for free?

I remember back in 2000 during the dot com bubble all of these companies would pay you just to surf the internet using their browser or plugin. We may be in another bubble of some...

Cannabis Grow journal

Water You always want to make sure your water is at a pH of 5.8. I calibrated my pH meter and then measured my tap and RO water. You can always then measure these two as a...

Hacking your SRP time-of-use bill with a DIY Tesla Powerwall made from recycled scooter batteries

I've always been fascinated by technology. I love building all types of electronic projects and automating things. Recently I ran across a guy who discussed building a battery...

How to invest like a hedge fund manager with almost a 1,400% return in the last 14 years

A popular strategy that I have followed in my investments is crowdsourcing hedge fund manager investments. Many people don't know this but any hedge fund that manages over $100...

Getting St. Louis FRED Data in Google Colab for Python Analysis

At times when creating trading strategies using big data you need access to historical economic data. One of the best sources of data is the Economic Research branch of the St....

Tesla overpriced or room to grow?

Tesla overpriced or room to grow?

Normalizing Stock data for Machine Learning

When analyzing historical time frame data in machine learning it needs to be normalized. In this code example, I will show how to get S&P data then convert it to a percent of...

Government insurance

I assume you have insurance for you house, car, and health? Why not insurance to protect you from your government?

Predict S&P Using Google Colab & Facebook Prophet

A few years ago Facebook decided to open source Prophet. This is their analytics algorithm that uses an additive model to fit non-linear data with seasonality. I started to...

Memory handler errors in MT4 while importing history files or csv files

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

Monitor Account Balance and Send Email Alerts in Metatrader When Account Drops Below Threshold

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

Whittaker hourly ATR indicator for Metatrader

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

How MT4 Calculates Spread and How to Manually Change it.

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

Setting up Metatrader for better backtesting quality

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

Whittaker volatility breakout indicator

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

A Solid Trading Plan

Most beginning traders don’t know where to start or how to apply concepts to the markets. If you are a beginner, intermediate, or advanced trader the following document should be...

Whittaker COT index variant a

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

Setting up MetaTrader for better backtesting quality

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

Whittaker COT Index Variant-A

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...

Whittaker Volatility Breakout Indicator

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links...