Skip to content

Enrique Garcia

General musings from someone in over their head

Menu
  • Home
  • Program Journal
Menu

Hoping for live trading soon!

Posted on September 17, 2020November 28, 2020 by Enrique Garcia

I’ve been working on my code like a dog this whole time and have made some major progress recently.

One major change is to the “decision making” part of the code, the one that decides whether or not to execute a trade. Before, it was a large series of “triggers”, a bunch of if/else statements that would set off the trade. It became a hassle to organize them in such a way that it wouldn’t execute before taking in all relevant factors, and nesting conditions (putting conditions within conditions, where all the conditions had to be met) often presented problems when trying to debug problems, or figure out why it traded when it did. What I’ve replaced it with is a scored-based system, where it considers the same conditions, but it runs up a score depending on which ones are met. If it exceeds a certain number, it executes the appropriate trade. This has made the code run slower but has made it much easier to add or remove conditions, as well as debugging. I’ve even made it where I can give conditions weight, so that some are considered more strongly than others.

Another major development is that I’ve moved the code from my personal Windows computer to a dedicated Linux server. This achieves two things: the code runs faster (particularly on fetching information from the database) and allowed me to install a module called Trader, which embeds a group of PHP functions dedicated specifically to technical analysis. Things I’ve been having a rough time doing manually, like calculating MACD values, are now handled by Trader. The documentation is next to non-existent (all there is is a listing of available functions with an explanation of values to be used with the functions, but little to no explanation of what they output or why it’s done the way it is). So far this has resulted in finally being able to generate accurate MACD numbers and charts. I’m now going through my code and replacing the appropriate portions (mainly my custom, brute-force functions).

That said, setting up the server was a nightmare and a half for myself and my friend Peter, who goes to crazy lengths to help me out with the myriad tech problems I have. Mad props to Peter, you’re the real MVP!

One minor development is that I’ve finally been able to crack and implement my “indexing” idea, that of making my own stock market indexes (by market, by sector) that I will later use to start making predictive calls. A major problem with this was that I was previously relying too much on using my SQL database to handle the math, which I’ve since gotten over by simply letting PHP do it manually. It’s gone from taking around 180 seconds to process a single day’s worth of data to approximately 120 seconds to process 4-5 days’ worth of data. Now that it’s on a Linux server, it’s all the way down to around 60-70 seconds to process 5 days of data.

So for now I’m focusing on integrating the Trader functions into my code, which I’m hoping will only take a couple days. Once I’m done with that, I’ll move on to what will be the last major portion of the script: to run every single stock I have data for (that being all of AMEX, NASDAQ, NYSE and OTCBB, over 21,000 stocks) through the trading simulation to determine what stock(s) will be best to trade on a given day. That will involve coming up with another, separate scoring system, one which I’ll have to work on to determine what factors to take into consideration (success rate, average returns, etc.) and how to weigh each factor. I was hoping to have something “usable” by the end of this month but I’m thinking mid- to late-October might be a more reasonable “launch date”.

1 thought on “Hoping for live trading soon!”

  1. Pingback: The neverending process of programming something – Enrique Garcia

Leave a Reply Cancel reply

You must be logged in to post a comment.

Archives

  • August 2021
  • July 2021
  • June 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • September 2018
  • June 2018

RSS Finance News

  • U.S. natgas futures wrap up biggest monthly decline in 22 years
  • Snap earnings call: Improvements will take time to hit top line, CEO says
  • Diabetes drug developer Structure Therapeutics sets terms for $125M US IPO
  • Why did CureVac stock slip today? Declining market for COVID vaccines
  • AMD CEO Lisa Su: Company in a 'good position' for data center gains
  • Stoneridge appoints former Aptiv executive Jim Zizelman as president, CEO
  • S&P 500 hits the ‘January Indicator Trifecta,’ giving it perhaps 100% odds of 2023 gains

Trading Websites

  • Master the Market
  • QuantiInsti’s Blog

Recent Posts

  • Latest program update going very well!
  • First big program update all year!
  • It’s been a minute…
  • The major overhaul continues
  • Major program changes now in progress

Tags

AAPL Apple coding collectibles comic books data sources diversification Dow Jones ETF GME ideas insights investing IRIX KRP marijuana methodology MGY MYCNX NASDAQ NVAX opinion preferred stock programming progress project stock market TGIF troubleshooting TXMD wallstreetbets
©2023 Enrique Garcia | Built using WordPress and Responsive Blogily theme by Superb