When I stopped Procrastinating

No lies. In my younger years, I procrastinated a lot. I was always putting off homework and chores until I forgot about it. For whatever reason, I didn’t take many things seriously, and I didn’t care about doing things on time. Sure, I wanted to be smart, and I loved delving into things for which I had passion like computers and dancing, but I mostly wanted one thing in life: To be cool. I wasn’t.

What did it mean to be cool to me? In a simple definition, I wanted to live the life in which men wanted to be me and women wanted to be with me. I filled my head with pop-culture references and started reading self-help classics like How to Win Friends and Influence People. I read up on philosophy so I could wax intellectual with the artsy hippies, and I got into dance music so I could relate to the people partying in the clubs. I did everything I could think of to meet girls, become wise, and stay fit. I met some extraordinary women and made some great friends along the way, but I always suffered from shyness and a bit of social anxiety. Although an annoyance, that anxiety drove me to learn to prepare.

Once I got into a degree program at the University of Minnesota, I still wanted to be cool, but I started taking my academics seriously. Although I didn’t have my procrastination problem completely figured out, I was in a writing intensive program, and I felt I had something to prove. Transferring in from a community college, I felt my college experience was lacking. Everyone seemed smarter and better connected since most of the people in my cohort had started their undergrad at the U of M. I thought I had to catch up. I was wrong.

Most people were average, too busy to try, and not nearly as smart as I thought. Some people even openly admitted to plagiarizing content and simply changing words using Word’s thesaurus before handing it in as their own. I found that despicable and vowed to outwork the lot of them. If they were studying one hour, I was studying two. If they were posting essays, I was critiquing them. They were my competition, and I wanted to see what they were made of. That is when I stopped procrastinating.

One of the of the first things I noticed was anxiety relief. If I just took care of things when they were assigned, I didn’t need to think about them anymore. My mind was free to focus on my passions. It didn’t matter that I had to sacrifice the time; I still found a way to party plenty. With the changed perspective, I transformed into a bit of a workaholic.

The second thing I noticed was an overall improvement in my content. Since I had extra time to edit and expand the ideas, I was able to push my research, imagination, and explore the depths of my creativity. I was relentlessly critical in my self-talk, and I carefully crafted rhetorically sound arguments in my essays. I was proud to earn A’s from professors who rarely gave them. I showed promise, and I loved it.

These habits shaped the way I approached work too. I wasn’t employed to slack off; I was there to climb the ladder. Employment is a zero-sum game. If someone else gets the promotion, that means I can’t. It was just another environment in which procrastination wouldn’t cut it. I decided I am the guy to pick up the slack and step up to take the responsibility no one else wants. That work ethic has led to promotions at every job I’ve ever held. I am a ladder climber. I am a grinder. I am willing to put in the work.

Adopting an ethic in which procrastination is an after-thought got me to where I am today: 32 years young and still perpetually moving forward by writing, coding, and climbing the corporate ladder. I recently completed a certification in Data Analytics and designed my first web app. I’ve climbed the ladder into a technical position at work. I’m getting married to a great woman at the end of the year, have a lovely home and adorable dog… I have what’s left of the American dream, and I’m not about to stop plotting my path to wealth and retirement. All of this hard-work will pay off; it already has, and I think that is pretty cool.

Using VBA to Analyze Stocks

Coding in VBA to crunch excel spreadsheet data wasn’t very fun, but it was good mental exercise and got my mind working. I found the language obtuse compared to python, and making mistakes that output to the spreadsheet was annoying to clean up. Not to mention the numerous times I crashed the excel application with infinite loops, lol. Either way, I am proud of the code I wrote. I don’t do much stock analysis in excel, and typically use SQL and python for that stuff, but I still might revisit this exercise and use it to crunch some of the stock and option data I collect. My code produces the I-L values:

Sub stock_hw()

Dim total_rows As Double
Dim sym_array() As Variant
Dim total_volume As Double
Dim i As Long
Dim j As Long
Dim unique_syms As New Collection
Dim sym As Variant
Dim ws As Worksheet
Dim unique_index As Double
Dim first_price As Double
Dim last_price As Double
Dim first_bool As Boolean
Dim prcnt_chng As Double

'Creates the loop to go through each worksheet in the workbook
For Each ws In Worksheets

    'activate the worksheet and enter new column names in J and K
    ws.Activate
    
    'insert the headers
    Cells(1, 9).Value = "Ticker"
    Cells(1, 12).Value = "Total Volume"
    Cells(1, 10).Value = "Yearly Change"
    Cells(1, 11).Value = "Percent Change"
    
    'calculate the total rows to use in the array range
    total_rows = Rows(Rows.Count).End(xlUp).Row
    
    'add stock tickers to array
    sym_array = Range(Cells(2, 1), Cells(total_rows, 1)).Value
    
    'loop through array to find distinct values and add them to a collection object
    'set the collection to Nothing to reset it on each worksheet
    
    Set unique_syms = Nothing
    
    'resuming on error is needed or it will error on duplicate values
    On Error Resume Next
    For Each sym In sym_array
    unique_syms.Add sym, sym
    Next
  
'populate column J with distinct ticker values
    For i = 1 To unique_syms.Count
        Cells(i + 1, 9).Value = unique_syms(i)
    Next i

'USED FOR DEBUGGING 'Cells(1, 11).Value = Cells(2, 1).Value
'USED FOR DEBUGGING 'Cells(1, 14).Value = Cells(2, 9).Value
      
    'check to see if the distinct value = sym and total the volume if it does
    'j loops through the master ticker list
    'unique_index is used to stay on the correct distinct ticker
    'set the first boolean to true so the logic knows to store the first price
    
        first_bool = True
        unique_index = 2
        For j = 2 To total_rows + 1
            If Cells(j, 1).Value = Cells(unique_index, 9).Value Then
               total_volume = Cells(j, 7).Value + total_volume
               
               'Logic for storing the first price when it is greater than 0
                 If first_bool = True And Cells(j, 6).Value > 0 Then
                    first_price = Cells(j, 6).Value
                    
                   'set the first boolean to false so the logic doesn't change the first price
                    first_bool = False
                 End If
                
            Else
                'subtract 1 from j so you don't skip the first row for the next distinct ticker
                'also so you can select the correct last closing price
                 j = j - 1
                 
                 'set the last closing price value
                last_price = Cells(j, 6).Value
                
                'output volume
                Cells(unique_index, 12).Value = total_volume
                
                'output difference between start and end price
                Cells(unique_index, 10).Value = last_price - first_price
                
                'calculate the percent change
                prcnt_chng = ((last_price / first_price) - 1) * 100
                
                'output the percent change
                Cells(unique_index, 11).Value = prcnt_chng
               
               'format the cell color based on the percent change being positive or negative or 0
                    If prcnt_chng > 0 Then
                        Cells(unique_index, 10).Interior.ColorIndex = 4
                    ElseIf prcnt_chng < 0 Then
                        Cells(unique_index, 10).Interior.ColorIndex = 3
                    Else
                        Cells(unique_index, 10).Interior.ColorIndex = 2
                    End If
                                        
                'increase the unique index
                unique_index = unique_index + 1
                
                'rest the sum of volume so it doesn't carry over for the next ticker
                total_volume = 0
                
                             
                'reset the boolean value for figuring the first price
                first_bool = True
           
           'USED FOR DEBUGGING ' Cells(1, 11).Value = first_price
           'USED FOR DEBUGGING ' Cells(1, 14).Value = last_price
            End If
         Next j
'USED FOR DEBUGGING 'Cells(1, 15).Value = total_volume
      ws.Columns("A:M").AutoFit
    Next ws
End Sub

Thoughtful Thursday #7

Another thoughtful Thursday coming to you Saturday. Thursday has become homework day since I’m back in school, so I have less time to pump these out on those days. Even so, I’m still sticking with the title…

What I’m playing: The new league in Path of Exile dropped on Friday. I wish I had more time to play it! It seems pretty fun. I just hope the end game more rewarding than the last league. The new boss fights in the previews were really cool looking, so hopefully they aren’t going to be too rare, but it is GGG, so they I won’t hold my breath… Anyone unfamiliar, Path of Exile is a completely free to play action rpg. I’ve been playing it for 6 years. I can’t recommend it enough!

What I’m thinking: We got our 3rd homework assignment today! It is writing a couple python scripts to analyze some finical and polling data. My start to this assignment is going much smoother than the last one! Hopefully that means I’m thinking more algorithmically. I’ve worked in python a little bit before the class, so not everything was brand new. I can’t wait until we start working with Pandas and matplotlib!

What I’m eating: I’ve been making ranch wraps with bacon crusted turkey, shredded cheese, tomato, oregano, and a pinch of Lowry’s salt. They are delicious hot or cold. I’ve been bringing them to class with me in my new Titan lunch cooler.

What I’m watching: We’ve had Friends replaying in the background still. I think we’re both about sick of it though. I had a good laugh when Chandler gets a new laptop and is bragging about the 12mb of ram, built in spreadsheet capabilities, and 500mb hard drive it has. Our phones blow that away these days, let alone my gaming computers, hahaha.

What I’m missing: I miss trading. Being in school and working the morning shift leaves little time for me to keep up with the markets. I’ll be back on the grind eventually, but I definitely don’t need any more stress in my life, especially with a wedding around the corner.

Thoughtful Thursday #6

A few days late on this one, but better late than never!

What I’m doing: It feels great to be a student again. Every time I get out of my car and walk into the UofM building, I think about all the brilliance that has been through those doors before me and become inspired. Class is tough, but everyone in it seems supportive, and the teacher and TAs seem great. I’ve always believed you get out what you put in when it comes to learning, so I’ve been trying to put in 100%. This is only the beginning, but I love it so far.

What I’m watching: True Detective season 3 is over, but I haven’t finished it. We will be watching the last three episodes tomorrow. I can’t wait to find out how it ends. This season might be better than the first. The show we keep on in the background lately has been Friends. It is funny to see how many actors play small roles in it and also appear in shows like The Office, Parks and Rec, and others.

What I’m eating: Kristen finally let me cook salmon for her! I prepared it like my mom used to do: Miracle whip, garlic and Parmesan. Kristen loved it!

What I’m playing: I haven’t had much time for games lately, but I reinstalled Hunt: Showdown, and completely forgot how awesome that game is. I am glad they keep adding more content.

What I’m lifting: It’s still snowing.

Thoughtful Thursday #5

What I’m thinking: Since we have had a ton of snow this February, I’ve been thinking about my shovel technique. I think the best way to shovel a driveway is to start down the middle vertically. Then, horizontally push the snow closer to the banks of the driveway until you’re close enough to throw the snow far enough to prevent high snow banks. Shovel every 2.5-3 inches for the easiest time. Beyond that it becomes too much to push horizontally and gets heavy.

What I’m doing: I started school! We got our first assignment: Analyze 4000+ kickstarter records to identify 3 trends. So far, class is fun. I think the teacher has done a great job, and the cohort seems like a diverse group of bright people. I can’t wait to see how the class evolves.

What I’m listening to: My coworker turned me on to Denzel Curry (rap). I like a few of the tracks, but I’ll have to give it another listen before I can recommend any tracks. I’ve been listening to his albums on Spotify.

What I’m eating: I started eating a lot of nuts again. I prefer the Raw Unsalted mix nuts from target since it has a good variety! The pistachios are always soft.

What I’m watching: I discovered Hulu has Boston Legal! I used to watch that show with my mom when it first aired. I remember some of the episodes so far, but we’re still in season 1. I can’t wait to finally know how the series ends!

Thoughtful Thursday #4

I’m back to the blogosphere… if that is still a thing. Happy Valentine’s day!

What I’m doing: I have been enjoying my last week of freedom before the Data Analysis coding camp begins. The new video game, Apex Legends has captivated me and my group of friends. It is great to play if you have a squad of friends to play with; otherwise, it can be a bit of a drag playing with random people. I am excited to see how the game evolves, and I’m already impressed by the impact it has had on EA’s stock price.

What I’m watching: True detectives season 3 has been phenomenal so far. If you have an HBO subscription and aren’t watching it, stop reading this right now and turn on episode 1. You will not be disappointed as long as you’re into that genre. Besides that, we finally got bored of the office and started reruns of New Girl. That show is hilarious.

What I’m reading: I’ve been reading a lot of blogs relating to Data Science in an effort to familiarize myself with some concepts and terminology before school begins. I’ve explored decision trees, linear regression, and gradient boosting models using python and sci-kit learn so far, and I can’t wait to learn more about the mathematics and methodologies used for analyzing data!

What I’m eating: We cooked up a big batch of pork fried rice over the weekend! We threw in lots of broccoli, peas, garlic, basil, egg, and diced pork. It turned out great! Thanks kikkoman!

What’s I’m lifting: I live in Minnesota and the amount of snow getting dumped on us this year is impressive. We haven’t had this much snow in a long time so I should really dust off my skis and hit the hills! Shoveling along with a light kettle-bell workout is all I’ve needed to keep my muscles sore.

Thoughtful Thursday #3

What I’m Doing: I have the rest of the week off of work and am focusing on improving my python. I figured out how to connect to my Microsoft SQL Server using pyodb. Here is the easy to remember connection string using set variables:

cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)

From there, I have been using pandas and matplotlib to graph some of the financial data I store in my “Project Edge” database. I am practicing elements of feature engineering to see if I can get more insight from my data using machine learning in the future.

What I’m Lifting: As a Christmas gift to myself, I bought a 15lb kettle-bell and have been swinging that around a little bit. I want to get back into the gym, but I’ll tackle switching my hours and getting back to school first. In the meantime, I enjoy using it to work out and wish I would have gotten one sooner.

What I’m Eating: We made some fajita seasoning using some spices and herbs we had sitting around, and then cooked up a big batch of chicken and peppers. It was delicious! Much better than the store bought seasoning we used last time. Unfortunately, no margaritas since we’ve been out of tequila for months.

What I’m Thinking about: I can’t wait for warm weather. The past couple days have been the coldest days of the year coming in at -35f. Rigby couldn’t even last outside for more than thirty seconds!

What I’m Studying: I’ve been trying to add more elements of technical analysis to my financial data database, so I’ve been researching how to write things like sma, ema, Bollinger bands, RSI, etc… Some of them are much more difficult to write in SQL than I would have imagined! It has been some fun problem solving.

Thoughtful Thursday # 2

Continuing the trend…

What I’m thinking about: I should be focusing more on my python skills. I will have to brush up using a few online tutorials before I start class.

What I’m working on: I have a few on-going projects. I started collecting more stock data for my financial model to assist me with options trades. I’ve been writing new SQL scripts to join and analyze the data. Reading more about machine learning has me pondering the features I’d include in my predictive model.

What I’m eating: Nothing healthy this week. I have a weakness for Double bacon butter burgers from Culvers. I get one almost every week. This will change when my work hours shift in a couple weeks. I will miss them!

What I’m Playing: I’ve been grinding away in Path of Exile’s Betrayal League. My main build this league has been Storm Brand. I love it!

What I’m changing: My sleep schedule is going to changing over the next week and it is going to be rough. I am a night owl; however, I’m a little excited to try being a morning person again. My life has changed a lot over the past three years, and maybe the mornings are where(when) I need to be.

A Warning in my Execution Plan

Since I investigate a lot of SQL queries at my job, I’ve been studying techniques to optimize SQL Server functionality, create efficient indexes and examine SQL Query performance. I’ve learned a lot about reviewing execution plans, monitoring system performance, and using tools like Query Store and Wait Stats to dissect queries hogging resources. Overall, it has been interesting to learn more about the SQL Optimizer and how it all really works “under-the-hood.”

My ongoing personal project is developing trading systems to assist me in trading stocks and options. I recently collected a dataset of stock symbols and ohlcv figures for 2018 and matched it to the curated option order flow I collected over the year. I toggled the Include Live Query Statistics option and executed my query to join the datasets. When my execution plan displayed, I noticed the SELECT operator had a warning icon:

I expanded the properties and saw this message:

Type conversion in expression (CONVERT_IMPLICIT(nvarchar(5),[sopn].[sym],0)=[edge].[dbo].[FlowTotal].[Sym]) may affect "SeekPlan" in query plan choice, Type conversion in expression (CONVERT_IMPLICIT(nvarchar(5),[sxpr].[sym],0)=[edge].[dbo].[FlowTotal].[Sym]) may affect "SeekPlan" in query plan choice, Type conversion in expression (CONVERT_IMPLICIT(nvarchar(5),[s].[sym],0)=[edge].[dbo].[FlowTotal].[Sym]) may affect "SeekPlan" in query plan choice

This is a clear example of why reviewing your execution plans is an important part of SQL optimization. For example, this warning is essentially telling me I used a different data type to express the same data. One table stores stock symbols as nvarchar and another table stores stock symbols as varchar. In order to join the tables on the SYM column, one side gets converted so the data types match. Instead of forcing the system to convert the data, I adjusted the data type in one of the tables so they match. This is the result:

A warning free execution plan!

BONUS CONTENT (not by me):

A mini discussion on the differences between nvarchar and varchar:

https://stackoverflow.com/questions/144283/what-is-the-difference-between-varchar-and-nvarchar

What is the use of writing N’ ‘ in query sql server

https://stackoverflow.com/questions/28519231/what-is-the-use-of-writing-n-in-query-sql-server

Thoughtful Thursday #1

Inspired by Timothy Ferris’ 5-Bullet Friday where he lists 5 things he is keeping up on, I am going to list some things that I’m doing and thinking. I call the exercise Thoughtful Thursday.

Timothy Ferris is a best selling author and self-proclaimed human guinea pig. If you are unfamiliar with his work, I highly recommend checking out his blog here: https://tim.blog/

What I’m Learning: This week I’ve been focusing my efforts on improving my SQL skills. I completed SQL Server Performance Tuning part 1 last week and have been working my way through part 2 this week. I’ve learned a lot about the techniques used to improve both SQL server and SQL query performance. If you’re interested in learning about SQL server optimization and already know the basics, I recommend starting with this course from Udemy: https://www.udemy.com/sql-server-performance-tuning-part-1/

What I’m Watching: Lately I’ve been watching The Office on repeat. The antics of Michael Scott and company rarely get old to me. Although I love the show, I can’t say I love every episode. One of the episodes I regularly skip is Scott’s Tots. It is just too cringe…

What I’m Reading: I’ve been slowly working my way through Linear Regression And Correlation: A Beginner’s Guide. I am reading this as a way to prepare myself for the Data Analysis Boot Camp I’m attending through the University of Minnesota.

What I’m Eating: I ventured into the world of dried fruit this week! Historically, the only dried foods I’ve enjoyed are types of jerky. That is why I run http://ultimatejerkyreview.com. However, I had some delicious dried strawberries yesterday and I think I’m hooked!  

What I’m Thinking: Why did I wait so long to try a kindle? I used to love books, but after I started using the kindle app on my ipad, I’ve been powering through books much easier than their paper equivalent. Coincidentally, today when I was looking through reddit, I came across this study which perfectly captures the reasons reading on a kindle is so much less intimidating than picking up the hardcover: https://digest.bps.org.uk/2019/01/14/study-identifies-the-most-effective-mental-strategies-that-people-use-to-get-through-aversive-challenges/