Using Python to Download Yahoo Fantasy Sports Data into a Spreadsheet

I’m the self appointed data steward for the office hockey pool. We award small prizes for the team with the highest points every month. This requires saving the total points and standings by team at the beginning of each month. In years past, that would require me to log in on the first of the month and copy the League Overview table into an excel spreadsheet. As you can imagine, sometimes I’d be off by a few days or even miss a month entirely.

Tracking monthly points for my office hockey pool
Continue reading

Dynamic Pricing: How MLSE Controlled the Sale of Raptors NBA Finals Tickets

Full Disclosure: I am a Raptors’ Season Seat Holder and an avid fan

Someone paid $76,477.50 CAD for a pair of tickets to Game 1 of the NBA Finals in Toronto. The average household income in Toronto is $65,929 CAD.
The average ticket price of NBA Finals games in Toronto is $1,933 CAD. With these unbelievable numbers, what’s a fan to do? Do you fork over a month’s worth of income to hopefully see your beloved basketball team fight tooth and nail for a championship? Or would that money be better put to use towards a nice 70′’ TV to watch the game with family and friends and still have enough left over for your child’s college fund (RIP OSAP)? I’m not going to tell you what to do with your money, but in this article I plan to break down the science behind ticket pricing.

Continue reading

Free Local Pickup Option with Shopify

Shopify is great! It helps you ship your products all across the world for discounted rates. But what happens when someone down the street orders from you? Are they going to pay the extra few bucks to get it shipped? Most e-commerce stores don’t have a physical location so they can’t just come down to your brick and mortar to pick it up. Unless you’re selling high frequency, you probably have the time to have them meet you at your local mall to pick up their product(s). also, if you provide free shipping, this helps save you time and mitigate shipping risks.

Unfortunately, as of writing this article, there is currently no way to have a local pick up option in your Shopify shipping settings without having to pay monthly for an external app. It got me thinking, why is such a simple issue not addressed by Shopify? Maybe it’s to help you scale. Quite frankly, our shop (Ayah) works on low volume and we need to make sure the package gets shipped safely due to the fragile nature of our business (artwork). So it doesn’t make sense to pay so much to ship when I can just arrange a pickup meeting with my customer.

I have figured a worked around method to allow for our customers to have a free shipping option if they live nearby and are willing to make the journey.

Continue reading

How to Tag Products on Instagram with a Shopify Site in 10 Steps

UPDATE: AS OF SEPTEMBER 2019 FACEBOOK AND INSTAGRAM HAVE CHANGED SOME OF THEIR FEATURES AND THIS GUIDE IS OUTDATED. Feel free to try the steps and see if it’ll work for you, but beyond that I cannot help. Sorry!

My wife runs an e-commerce website for artwork. Her main customer base is on social media so she needs her store to connect to social media platforms in order to optimize all her sales channels. Her e-commerce store is based on a Shopify backend. We chose Shopify over alternatives like woo-commerce because it was easier to start up and the support they offer is parallel to none.

Facebook was by far the easiest connection, within a matter of seconds, we got the artwork for sale on the Ayah Collective facebook page without any issues. However, Instagram product tagging has become a headache that we could not solve. Until now.

Continue reading

Where the Money Comes From: Toronto Councillors

The Toronto Municipal Election is scheduled for October 22, 2018. Incumbent mayor John Tory is running for re-election, but there is expected to be a lot of change in terms of those governing the city. Toronto City Council has added the new wards in the downtown core to account for the rising growth in population at the city center. In addition to that, some current councillors are not running for re-election. I would like to do some analysis on the campaign contributions to candidates running for mayor and councillor positions. Who received the most campaign contributions? Has anyone received the most donations for their position in their ward, but fail to win the election? Who is contributing the most money to these elections? These are some questions I’d like to answer using real election data.

Data was obtained from the City of Toronto Open Data Catalogue. Python code used for cleaning the data can be found on my github.

Continue reading

Was there a Toronto Real Estate Bubble?


The Toronto Real Estate market (and it’s surrounding areas – the GTA) have been red hot coming into 2017. According to the Toronto Real Estate Board (TREB), home prices on average have risen over 65% from 2012 to 2017 (TREB Historic Statistics). I decided to pull the TREB numbers into an excel sheet and see if there was anything we could learn from the data.

It seems the average sales price for homes in Toronto has not gone down in 20 years! That’s incredible. If you were to buy a home in 1996 for the average price of $198,150 and sold it in 2017 for the average price of $822,624, you gain a 315% return on investment! Of course hindsight is 20/20 and considering home prices took a dip in the 90s, you would be a little bit more hesitant on purchasing a home for investment purposes.

That being said, young Torontonians are currently facing a dilemma of being unable to afford purchasing a home due to the average 7% growth rate in sales prices since 1997. The median household income in Toronto was $78,373 in 2015 (StatsCan). Assuming a family making the median household income plans to get a mortgage, it is impossible for them to get a home for the average home price in 2017. At most they’ll be able to borrow $350,000 on top of their down payment towards paying for a home (CIBC Mortgage Affordability Calculator). Some critics have even classified the unprecedented growth in the GTA as a housing market bubble with an inevitable impending crash.

To combat these unprecedented increases and to help home ownership for Toronto residents become a reality, the Provincial and Federal governments have respectively introduced new laws. The provincial ruling focuses on creating a tax for foreign buyers that hold their money in speculation that their real estate investments will go up. The Federal government’s approach was to protect home owners’ ability to pay their mortgage payments if the interest rates go up. Currently in Canada, interest rates have been hovering near an all time low since the Global Financial Recession of 2008.

Bank of Canada overnight rate 1990 – 2018. Source: | Bank of Canada

Non-Resident Speculation Tax (NRST) – effective April 21, 2017

More commonly known as The Foreign Buyers Tax, the NRST is a 15% tax on the purchase or acquisition of a residential property located in and around the Toronto region (especially the Greater Golden Horseshoe Region – GGH) by a foreign entity. The NRST was implemented in Ontario following a similar program to mitigate the rising prices of homes in British Columbia. The provincial government of Ontario stated that foreign entities accounted for 3.8% of transactions in Toronto during the season after the implementation of the tax. This might seem like a small percentage of the market, but removing those properties can impact the liquidity of the real estate market.

Residential Mortgage Underwriting Practices and Procedures – effective January 1, 2018

More commonly known as The Mortgage Stress Test, the Office of the Superintendent of Financial Institutions (OSFI) set a guideline that required uninsured mortgages to pass a “stress test” for the qualifying interest rate in a mortgage to be greater than the 5 year benchmark rate + 2%.

For example, the current 5 year benchmark rate is 5.14%, so in order to get an uninsured mortgage, one would have to be able to pay mortgage payments with an interest rate of 7.14% (5.14%+2%). Uninsured mortgages in Canada are generally mortgages that had a 20% or greater down-payment. Thus, the borrower would not be required to pay CMHC fees to become insured so there is no protection for the lender if the borrower defaults. Continue reading

How to Import Snapchat Spectacles Videos into Instagram

Snapchat Spectacles videos are simply amazing. They’re HD and you can rotate your phone to see more angles of the same video. Furthermore, the fact that they double up as sunglasses, allows you to take a stable video without carefully holding your phone out in front of you. Unfortunately you cannot currently take pictures with the Spectacles, but I’m looking forward to that future capability.

The videos can be exported outside of the Snapchat app so you can share it with friends on other social media platforms. Unfortunately, once exported, the videos come out to be circular with a lot of white space in a square frame. So how can you post these amazing videos on other social media platforms? This blog post will focus on how to select the optimal viewing area to share videos on Instagram. You can then extrapolate this technique to share videos on other platforms as well. Find out how to do it in 3 easy steps below!

Continue reading

Pulling Stock Data and Creating an Efficient Frontier in Excel

I mentioned in a previous post on how to get (nearly) live stock data from Google Finance. However, if you start pulling data from different markets, daily historical rates won’t make sense as different markets are closed on different days. This causes problems when trying to figure out the correlation between stocks. A solution to this is to pull monthly rates as the adjusted stock price for each month will be a better indicator of correlation.

Python has a great library called pandas_datareader that allows you to pull in historical information right into a pandas dataframe. The only downside is if an API is deprecated, your code breaks. Hence, I’ve elected to create this tutorial using Yahoo Finance’s Historical data download function. The objective of this article is to pull a large amount of worldwide historical data (over 20 years worth) and then use Modern Portfolio Theory (Mean Variance Optimization) to create an efficient frontier. The efficient frontier can help decide asset allocations in your portfolio based on a given risk tolerance and expected return.

Continue reading

Scraping Stock Data from Google Finance

For this tutorial we will be using Google Sheets. Google Sheets is a great resource for scraping data from the internet and it’s free!

First, we need to set up our Google Sheet in a format that will make pulling the data easy and accessible for future analysis. In the first row, add in the number of historical work days you’d like to go back into cell A1. We chose to go back 470 days which is just under two years of data. Then, on every next column, add in the Tickers for the stocks/ETFs that you’d like to pull data for. Keep in mind that the number of days back must be less than the lifetime of each your stocks have been on the market. Otherwise, the dates will not correspond with the stock prices for certain newer stocks. By lifetime of a stock I mean the difference between today’s date and the date that the stock had an IPO (went into the market).

Continue reading

action cams

Removu K1 vs DJI Osmo+ vs GoPro Hero6/Karma vs Feiyutech Summon+

The GoPro was one of the biggest revolutions when it came to shooting live action footage. Unfortunately, what many people weren’t aware of was with any camera, shooting video is incredibly difficult without a stabilizer. You end up with a lot of shaky cam and unusable footage, even with a warp stabilizer during post production. So now that the GoPro fad is starting to die down and cellphones are powerful enough to shoot, store and upload our home videos, what is a traveler on a budget supposed to do? No, I don’t think it’s the best idea to hook up my Pixel 2 with a DJI Osmo Mobile 2 and walk around foreign streets with a target placed on my back. A great travel action camera + gimbal should be able to be discrete, easy to pack/carry, and have a long battery life to avoid having to find an outlet.

I’m creating this comparison because my GoPro Hero 4 silver and FeiyuTech G4 stabilizer succumbed to water damage and now I need to decide on what Action Camera+Stabilizer combo I’d like to use to create my travel videos. Although I could find articles on the web praising each camera and videos trying to compare them, I couldn’t find a one solution check list that would list all the specifications in one place. Keep in mind that the specs are not the only things you should look for in a camera. Some shoot better in low lighting and others have more vivid colours. Unfortunately my specs table will not go that granular when it comes to detail. Rather, it will approach the problem as someone who is a hobbyist videographer and what they might want in a camera.

Continue reading