Thanks to supporters

I hate to use the term ‘life changing’ to describe what’s happened lately, but I’ve seen a few orders roll in for the EICAR products that I put together and it has really made my week. I’ve been dreaming of leaving the rat race and having some sort of self-sustaining revenue streams to help me escape wage-slavery or whatever you want to call it. I’m not being very eloquent right now, but the plan is to escape the need to trade time for money, and seeing these orders come through and be fulfilled without any additional effort on my part seems like a dream come true.

Love him or hate him, Tim Ferriss has been a huge influence on me. I read the Four Hour Workweek when it first came out, but for whatever reason I’d never been able to take that leap and to full bore into something that could do that type of revenue-generation. About the closest I’ve ever come to it has been investing, whether buying stocks or crypto and seeing things take off of their own accord. (The 15% rally in BTC this past week is no doubt affecting my mood.)

I’ll be honest, I won’t be paying the grocery bill with the proceeds from the sales that I did, but this past week is very inspiring and helps reinforce that another way is possible.

Automating value average stock investing

I spent most of the winter break working on automating a value averaging algorithm that I wrote about several months ago. Back in October we started scaling into three positions that we identified based on our work with some predictions we did using Facebook’s Prophet earlier. My goal was to develop a protocol and work out any kinks in the process manually while I worked on building out code that would eventually take over. While I’m not ready to release the modules to the public yet, I have managed to get the general order calculation and order placement up and running.

To start, I setup a Google Sheet with the details of each position: start date, number of days to run, and the total amount to invest. I used Alexander Elder’s Two Percent Rule, as usual to come up with this number. Essentially each position would be small enough that I wouldn’t need to setup stop losses. From there, the sheet would keep track of the number of business days (as a proxy for trading days) and would compute the target position size for that day. I would update a cell with the current instrument price, and the sheet would compute whether my asset holding was above or below the target, and calculate the buy or sell quantities accordingly.

After market open, I would update the price for each stock and put in the orders for each position. This took a few minutes each day, and became part of my morning routine over the past two months or so. Ideally, this process should have only taken five minutes out of my day, but we ran into some challenges due to the decisions we made that required us to rework things and audit our order history several times.

The first of these was based around the type of orders we placed. I decided that I didn’t want to market buy everything, and instead put ‘good-until-cancelled’ limit orders in. When there was no spread between the bid and the ask, I would just match whichever end I was on, and if there was a split I would put my order price one penny in the spread. As a result, some orders would go unfilled, and required some overly complicated spreadsheet calculations to keep track of which orders were filled, what my actual number of shares was ‘supposed’ to be, and so on. I also started using a prorated target, based on the number of days with actual filled orders. This became a problem to track. Also, some days there were large spreads, and my buy orders were way lower than anything that would get filled. There were times when the price fell for a few days and picked up some of these, but keeping track of these filled/unfilled orders was a huge pain in the butt.

One of the reasons that it took me so long to develop a working product was due to the challenges I had with existing Python support for my brokerage. The only feasible module that I could find on Pypi had basic functionality and required a lot of work. It had no order-placing capabilities, so I had to write those. I also got lost working through Ameritrade’s non-compliant schema definitions, and I almost gave up hope entirely when I found out that they were getting bought out. The module still has a lot of improvements needed before it can be run in a completely automated manner, but more on that later.

So far I’ve got just under a thousand lines of code — not as many tests as I should have written — that allows me to process a list of positions, tuples with stock ticker, days to run, start date, and total capital to invest. It calculates the ideal target, gets the current value of the position, and then calculates the difference and number of shares to buy or sell. It then places the order. I’m still manually keeping an eye on things and tracking my orders in the sheet as I’ve been doing, but there’s too much of a discrepancy between the Python algorithm and my spreadsheet. I don’t anticipate trying to wade through my transaction history to try to program around all of the mistakes and adjustments that I made during the development process. I’ll just have to live without the prorated targets for the time being.

I think priorities for the next few commits will be improving the brokerage module. Right now it requires Chromedriver to generate the authentication tokens; this can be done using straight up request sessions. There’s also no error checking; session expiration is a common problem and I had to write a function to use to refresh it without reauthentication. So first priority will be getting the the order placement calls and token handling improvements put in and a PR back into the main module.

From there, I’d like to clean up the Quicktype-generated objects and get them moved over to the brokerage package where they belong. I don’t know that most people are going to want to use Python objects instead or dictionaries, but I put enough work into it that I want it out there.

Lastly, I’ll need to figure out how to separate any of the broker-specific function calls from the value averaging functions. Right now it’s too intertwined to be used for anything other than my brokerage, so I’ll see about getting it generalized in such a way that it can be used with Tensortrade or other algorithmic trading platforms.

I’m not sure how much of this I can get done over the spring. Classes for my final semester at school start next Monday, and it will be May before I’m done with classes. But I will keep posting updates.

Will this image break automatic camera scanner systems?

EICAR antivirus test string

The image above is a QR-encoded representation of the EICAR antivirus test string. The string (`X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*`) is used to check the effectiveness of antivirus systems without using actual malware. It was brought to my attention via a Tweet by computer security Rob Rosenberger in which he placed QR code on his car during a recent road trip. The intention here being to get automated scanners to read and insert the string into their databases, hopefully causing them to crash.

A few people mentioned how they wanted these on hats or shirts, so I spent some time today putting a couple of products up on the ecommerce site. After I put this out, someone noted that this string only works if it is the only data in a file, which reduces the likelihood that it will actually cause any havok.

Still, if the idea of trashing facial recognition systems or license plate scanners sounds like fun to you, then perhaps you’ll be interested in this.

2020 Goals

I’m 40 years old, which means that I’ve spent half of my life in the 20th century and half of it in the 21st. Perhaps that’s why I wasn’t excited with the fact that we last night we moved into a new decade. I was reading a book last night when midnight came; my family was asleep. There had been pops of fireworks going off before midnight, but there was a point when they started firing off continuously when I knew that the New Year had come. I wasn’t sure whether it was the City or the nearby military base where they were going off, but after about what was likely the official display ceased, what sounded like small arms fire kept going on for another twenty or fourty minutes. I imagined handguns or semiautomatic rifles being fired off in the air. (I once found a spent 9mm bullet laying on my porch step, no idea where it came from.) The explosions were punctuated with the sound of sirens as emergency personnel responded, either to the illegal fireworks, firearms, or perhaps to some actual injury.

  1. Finish my degree: I’m one semester away from getting my bachelors in computer science. I’ll likely finish with a >3.5 GPA. This should open up some opportunities, but the worst thing about it will be that my loans will come due. This will likely cause some financial hardship until I accomplish #2…
  2. Get a raise: I’ve been at the same job and salary for four or five years now. My wife outearns me by a great deal, and it’s not a problem, pride-wise, as much as it is a difference in lifestyle. My budget is extremely tight and is a subject of stress, while she seems to have a lot more discrecion in how she handles her finance. I know that even with my lack of anything more than an associates degree I’m underpaid, but the freedom I have with my current job makes up for it. That freedom has downsides though, and it’s time to step up. Unfortunatley, I’ve come to recognize that my current job is with a zombie firm, which is why item #3 is…
  3. Find a new job: I’ve been with my current job for 7 years, which is longer than I’ve ever held a position anywhere else. I tell my wife I’m unfireable because of key-man risk, but I’ve come to realize that everyone else on my small team is as well, and that’s not a good thing. I’ll have to expand on this later. I have no desire to go back to a corporate position where I have to work more than 30 hours a week, so I will have to make sure to focus on #4…
  4. Pickup more freelance/contracting work: Until the next Bitcoin bull run makes me independently wealthy, I’m going to have to focus on expanding my independent work and pick up some actual clients. I just need to pick up sixteen clients at $250/month retainer to replace my current real job, so I’ll just need to focus on picking up a few more and staying on top of things while I work on a few more large development projects.
  5. Get my daughter sleeping in her bed: She’s three years old now, and still can’t fall asleep on her own. I don’t know if we broke the first one doing it, but at least she goes to bed without having to lay down next to her for twenty minutes. This will be a long hard fought battle, especially until I can get my wife on board.
  6. Deal with my defiant child: I have two daughters. My boss has two as well, and often tells me that I have no idea what kind of shit I’ll have to deal with when they become teenagers. He assumes they’ll live that long. I would suspect that my eldest has oppositional defiant disorder save for the fact that she’s an angel with everyone but my wife and I, so I just assume it’s our lack of parenting skills. I’ve got some books that I’m reading and some strategies that I’ll be working through, so we’ll see how that goes.
  7. Continue to meditate: Such a simple thing to do that has such a good impact on my well-being. I don’t know that I’ll be doing hour-long sessions, but twenty minutes a day seems like such a no-brainer. Figuring out how to make it part of my daily routine and get the kids involved will be key.
  8. Exercise regularly: I’ve been through so many phases on this that it’s ridiculous. I’m really going to need to prioritize this, along with meditation, to make sure that it gets done on a regular basis. When I’ve done so in the past, the results have been tremendous, but it’s been so hit or miss lately.
  9. The drink: the hundred-plus days off the wagon that I did late last summer was one of the best things I’ve done for my health. I’ve already accepted the fact that I’m an alcoholic (an addict might be a better description,) so I have to figure out whether I want to continue being a functioning alcoholic or what.
  10. Up my piano skills: music has always been part of my life, and I’m finally getting to the point where I can sight read. Besides a few pop tunes that I’ve been playing around with, I’ve almost mastered a Bach minuet. I really want my kids to pick this up by my example, but I’m having difficulty figuring out what an appropriate goal for me would be. Bach’s Inventions should be something I can achieve this year.
  11. Write: I am going to start a 1000-day goal to write at least 200 words to this blog.

Wish me luck!