Trial and Epic Fail

Ventures of an indie game developer

Scrapping my approach

I realized that half of my trading bot is worthless. It's not a huge surprise, as I went in to this with a brute force, try anything simple approach. Here's approximately how I've spent my dev time:


So half of the code is shit. It may or may not make a profit, it matters not.

Initially I just waved off the technical analysis concept; as usual for me I wanted to try from the ground up first. Now I have. That didn't work, but I found that technical analysis definitely will. From hereon have four options:
  1. Rewrite the core analysis and time-of-day trade bits.
  2. Same as 1, but also use numpy and pandas for the data processing, resampling, etc.
  3. Total rewrite, with a pinch of copy-paste.
  4. Total write and change of technology, using neural nets for the analysis.
I've spent six months on it, but the question now is not if I've wasted X time, but how I want to organize it to support my Y time left in life. The choice can be only one. Three, I mean.

3. Total rewrite

I have no doubt it can be done extremely well with a neural net, but I'm not knowledgeable enough and the learning curve is steep, plus I'm slightly biased against it for debuggability reasons.

It will take me a month to get a prototype running, which means two calendar months. But then only a couple of days to bug fix, tweak and put in production. I'm absolutely confident this will work, and the yield will be great again. Absolutely terrific! A yield like the world has never seen before. Amazing.

Delta price

The ask/bid delta may be one of my biggest problems. Here's an image of what I mean:
Even though this imaginary stock's trend (of course both asking price and bid) are going up, the discrepancy is going to cause a loss in this scenario. Between this and the commission, my downfall might be imminent. But I doubt it. I still think I'm going to find some way to earn money off of this. And the main reason I'm confident is that the stock market is not random. Things happen for a reason and whenever human psychology is involved, there's a certain inertia which can be harvested. Eventually I'll be a farmer and not the crops. ;)

NRG and Nazis

The energy revolution is coming along nicely. Two months ago the E-Cat/Rossi litigation was won, with both patent and license returned to inventor Andrea Rossi. This is by no means the only hint that things are moving in the right direction. There have been independent cold fusion/LENR replication of all sorts. Martin Fleischmann Memorial Project have three different groups independently seeing neutron emissions. A US Department of Defence document became unclassified, supporting Widom/Larsen LENR theory. NASA replicated and pondered LENR aircraft. MIT's NANOR device have showed a COP of 12, and in 2013 increased it to COP 80. Brillouin Energy claims to be close to a technology breakthrough. CNN interviewed Brilliant Light Power on their "SunCell" LENR product. CBS 60 minutes published Cold Fusion is Hot Again. In 2017 US Congress requested a briefing from Secretary of Defence on the topic. And so on, and so forth. (Anyone who likes can of course sit through hours of Myron Evans boringly reading his essays Unified Field Theory, but not sure if that helps in understanding LENR, and perhaps even less so in unifying quantum and relativity theory.)

Andrea Rossi and his invention, the E-Cat, still seems to be on top, with the 1MW industrial-grade solution verified, all the while claiming that he's close to finalizing a consumer-grade product, E-Cat QX.


Some of the most interesting things for me, as an intrigued amateur, are some of the super-simple LENR experiments that have been published: Cold Fusion in the Pot, Parkhomov's E-cat replication, How to Make Cold Fusion, Free From Fuel. You can even order your own LENR start-kit for 300 USD.

I recently took a Tesla P100D test drive. The performance of a proper electric motor is no childs-play although it feels like sitting in a very high-performing roller-coaster. Here are some reactions to the less performant P85D:


Goes without saying, I was sold after my first Ludicrous Launch. The only thing remaining is that manufacturing the Tesla batteries are very bad for the environment. Hopefully LENR can remedy this in a few years.

One more thing is of the essence here (which often is claimed to be but rarely is). Terrorism. Put infinite energy in the hands of a terrorist and everything dies. I have no good solutions to that one. For me, as an amateur student of parapsychology, an interesting side-note is that the head of Waffen-SS in Nazi Germany came up with the crazy holocaust idea partially as a means of trying to avoid civilizations imploading. One-ness by eliminating others. Let's make sure history doesn't repeat itself. But let's also enjoy the ride. Now is a good time to be alive!

Hope and dispair

This morning when trading started, I was able to purchase a 10x oil bull certificate from Nasdaq Stockholm at the bidding price in 20 seconds, so apparently my LERP'ing method can work. At least in some instances. Wohoo, this means I have a first working version?!? Hehe, I'll try not to go from dispair to hope in half a day. The rebound is so bad. (Also the chosen instrument is down by 4.7% in the 2.5 hours since the bot bought it, so that could have been reason for alarm. But for now I'll write it off as human psychology.)

Only a few, fun features remain, and those I can add in my own good time. These features include visualizing actual profits; automatically including new instruments in the pool, but they have to be quarantined first (as their missing historical data looks like stability to my algorithms); removing expired instruments; and possibly blacklisting unethical things like oil and weapons.

Late afternoon the bot will sell and then I'll have an extra data point on my LERP'ing thing. In a few days I'll know how effective this solution is. It could be that it's only working when the prices are falling, so perhaps it could be used for decision-making. For now I'm just glad it seems to be going my way.

High peak and back

Back from a week in Laponia:


Good stuff! In the mean while the trading bot was doing it's thing. No serious bug arose during the week, but I was right about the ask/bid delta price being a problem. It caused a 17% decrease in my funds instead of the calculated 12% increase! If I am unable to mitigate, this could be a show-stopper.

First I'll try LERP'ing when placing orders (while collecting some more data for future analysis). For example, I'll first place a buy order at the general bid. If that doesn't go through (in a minute), I'll place the buy order price at lerp(bid,ask,0.1), etc. I'll reverse the LERP in the selling case. This process, in itself, could affect the price if the volume is high enough (on a low-trade instrument), but it can't be any worse than it already is. I hope.

There are other things that could increase profit, but the question remains how much optimization I'm able to muster. Going from -17 to +12 is no small feat indeed.

Real nigga letters

I could start writing Nigerian letters - for real - soon. Or well, it's not an investment that scales unfortunately, but it's going to be interesting to see where that breaking point is. It's going to turn out as one of these three:
  1. High-risk savings.
  2. Enough to earn a cheap living.
  3. Get rich fast!!!
The reason it's nothing in between is that until I hit the threshold, the curve is polynomial. Which means that if the ceiling is in the few hundreds (EUR/USD), it's number one. If it's in the thousands, it's number two... If it's in the high thousands or ten thousands...

MOFO!

There are still some looming problems on the horizon, like the diff between the asking price and the bid, which can be up to 10-15%. Which then (might) means one has to make a 10-15% profit before buying or selling. Right now I just hope that such wild deltas are uncommon, I haven't looked into it yet.

I have seven or eight features missing, which would be good to have if this takes off. They might take a week or two of full-time work to implement, so nearly done with a fully automatic money-making machine.

My vacation starts today, so hopefully I can write up a post-mortem for this project in a month or so. Til then - ta-da!

Auto trade sequence initiated

I'm counting on the agent to have poor judgement in the beginning, due to a flaw in my reward algorithm, but I don't care. Right now I just want to get the ball rolling. I suspect the first few days of automated trading will be a little shaky in general, as I've avoided most exception handling in an attempt to ensure I do it right. My confidence in the just implemented buy-and-sell algorithm is 50% that it will do any trading at all. It would have been easier without a day job (but perhaps that little annoyance will go away soon).

In a few days it should stabilize, and hopefully the algorithm on what to trade in will too.

About the author

Mitt foto
Gothenburg, Sweden