Categories
Uncategorized

A Small Retrospective

Our cloud based algorithmic trading optimizer project has come a long way since we first started planning for development ~6 months ago. At first I was much more daunted with this project and skeptical as to my ability to meaningfully contribute to it, but as true development began at the start of this term I quickly realized that I was indeed able to contribute, I just had to be ready to learn.

From this project I have grown substantially more familiar with the React.js library and have grown to enjoy using it quite a lot. It seems like a very valuable to tool to have knowledge of within the web development industry. I have also gotten some exposure to Flask which I had little to no prior experience with. With this we made an impressive Flask+React framework following somewhat of an MVC architecture with a standalone front end that then sends data to and from the Flask backend utilizing routes and route handlers.

This has also been my first time working on a project of this scale with a team. While a little skeptical at first, I quickly realized that we had a good sense of teamwork and we were all there to help each other succeed and make progress on our project.

Overall working on this project has been a great learning opportunity. I am now much more comfortable working with a team and I have learned a lot about practicing Agile and the general software development lifecycle. I now have a few more handy skills to have in my back pocket when it comes to programming and am much more familiar with web development overall and even more so React.js specifically.

Categories
Uncategorized

Tech Talk

So far the cloud based algorithmic trading project is coming along quite nicely. We got past most of the hurdles that came up in the beginning of our development and are now really getting into the meat of the development. We are using a small plethora of technologies in out stack for this project including, AWS, Flask, MySQL, and React.js. As I have been primarily working on the frontend the technology that I have been using the most is React. Before this project I had a small amount of React experience from a previous computer science class here at OSU, but now that I am utilizing it for a bigger project I now see that we barely tapped into the potential of React in that class. As I have been learning more and more about the React library I now see how great of a job it does blending html and Javascript into a user friendly format.

React allows you to define Javascript functions that return html elements. You can then nest these components to have a “tree” of components that make up the entirety of your web applications frontend. In these functions you can also have functional data handling with useState and useEffect which allow you to update data based on user input and then redisplays it to the page. React also allows you to easily ‘escape’ into javascript within the html code making it even easier to manipulate the data within your application.

A technology that I am less familiar with, that we are also using, is the Flask framework. We are using Flask to handle the backend and routing to ‘serve’ the React based frontend in somewhat of a Model-View-Controller (MVC) architecture. This allows us to have the benefits of a React based frontend while allowing all of our backend Python code to operate on its own without having to mingle the Javascript and Python languages.

Overall learning these technologies (while a little daunting) has been great and I am looking forward to continuing to make progress on our project.

Categories
Uncategorized

Clean code that doesn’t smell

Well we are back from winter break, and that means getting back to work. We are finishing up the planning and design for our algorithmic trading program which means we can start the fun of actually coding it and seeing results. This means that we are going to have to write some clean code that doesn’t stink, that’s what we are going to be talking about here today.

So what is clean code?
Clean code should be well commented code that is easy to read and understand. A common quote on the subject that I enjoy is,

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

This encapsulates the core idea of writing clean code. It needs to be understandable to any other developer that may be working on the same code presently, or in the future.

This article does a good job discussing what clean code means and how to achieve it. Some good rules to follow when writing clean code includes:

  1. Avoid hard coded numbers
    • Hard coded numbers makes it more difficult to understand the purpose of the value when it could have a descriptive variable name in place.
  2. Use meaningful and descriptive names
    • The names of variables and functions should give anyone reading it an idea of what it does or what its purpose is.
  3. Leave meaningful comments
  4. Write functions that do a single thing
  5. Follow DRY (Don’t Repeat Yourself)

After looking into what makes clean code and how to avoid code smells I have found a few areas I could improve in when it comes to writing clean code.

I often implement overly complex functions that do more than one task and it could simply be broken into multiple simpler functions. I also could leave better comments in my code, I often comment code more with myself in mind than others and commonly leave comments where I think they will be useful to me. As for descriptive names and hard coded numbers I believe I do a good job following these standards in my code.

Going forward I would like to make sure to leave better comments in my code with other people in mind so that they can more easily understand what is happening within the code. As well as, write simpler functions that only do one task so that their functionality is more intuitive and easy for others to understand.

Categories
Uncategorized

Garbage in Garbage out

So far our algorithmic trading project has been coming along nicely. There has been one problem that has plagued us since the start though… Our backtesting results from the backtesting.py library were not matching up with the results we were validating them against from Quantconnect Lean. We spent a lot of time fiddling with different input parameters in the backtesting.py functions to try and get it to line up, and could get close but not it was not quite close enough. We recently got some news from our sponsor though that the data being input to Quantconnect Lean was actually invalid. There was a truncation problem where the data from yfinance was being truncated to only 2 decimals places when it was fed into the Quantconnect Lean backtester. Obviously this is a pretty large problem as without realizing this there was no way we would get the output backtesting.py to line up with Quantconnect. Now that the team is aware of this though I am hopeful that we will get our data from backtesting.py validated in a timely manner and be prepared to implement it into our program.

Other than the aforementioned the team has been working on getting our tech stack all setup for us to begin real the heavy lifting. One of our team members is getting an AWS cloud environment set up for us to have a cloud based web application. I am daunted but exited to be doing some cloud work, as I have little to no experience with it but am looking forward to learning more about it as I know its a useful technology to be familiar with. Another team member is getting a mySQL database setup for us which will be very useful for us to store our optimized algorithms and perhaps historical stock market data as well.

I have been busy gaining familiarity with the current codebase of our project and its frontend so I can have a plan for how I want to migrate it over to React. Ideally this migration will be worth it and will allow us to have a faster more lightweight web application with a better user experience and more maintainability for the codebase.

Winter break is coming up for us so this is the last blog post for this year. Overall im pretty excited to see how our project comes along and am looking forward to continue working on it.

Categories
Uncategorized

My React-ions

It’s been a little while since the last blog post, so I’ll bring you up to date. I got assigned the project I wanted which is, “Cloud based Algorithmic Trading” The goal of this project is to create a program that can optimize trading algorithms and show the user various data points to help them determine and create a strong trading algorithm. With the stretch goal of perhaps integrating this with a stock brokerage and allowing for automated trades based on a given algorithm. All in all I am very excited to be working on this, even though it is a tad daunting.

In the past few weeks our team has been working on breaking the project down into functional areas and assigning them to team members. We also have drafted our design document to specify how we plan to make this project come to fruition. The function area I am assigned to is the front end of the project, so its up to me to figure out how we want to implement a solid user interface. After a little research into the options for this I decided to use React.

I have utilized React before, but I am honestly not very well versed in it. So, I have been doing some digging into it, watching some tutorials and trying to get a better understanding of it. As I have learned more about React I can see how it seems like a very useful tool for creating user interfaces. All in all, I am slowly growing more confident with it, but I’m sure I wont be completely comfortable with it until I have seriously used it for a while.

I believe that is all I have to update on my adventures in computer science so far. Our projects v0.0.1 is due in about two weeks, so I am sure I will be posting updates on that in the next blog post.

Farewell!

Categories
Uncategorized

Introduction!

Hello all! Welcome to my Adventures in Computer Science blog. My name is Ronson. I live in Eugene Oregon with my wife, and have lived in the area my entire life. When I am not working or doing school work, you will typically find me fishing, playing pool with friends, or working on one of my cars. I also have a hobby of brewing my own beer and wines.

My interest in computers first started when I was a kid, probably about 10 years old, from playing video games, and figuring out how to download mods for my favorite games. From there I also got into computer hardware and started building my own computer. I was shocked at how simple a lot of the computer hardware is these days to install yourself.

Once my college journey began, I started my 2 years at Lane Community College with the original intention of going for a major in chemistry. Fairly quickly I realized that although I was passionate about it, chemistry was not what I wanted a career in. And so started my computer science journey. After my 2 years at community college I transferred to Oregon State University. I have now had 1 full year at OSU and this is the start of my second. So far I have really enjoyed learning all of the technologies and concepts presented in the various computer science classes I have taken here. I especially enjoy the lower level programming languages C/C++, partially because that is what I primarily worked with in my first 2 years of college, but also because I like the low level data and memory manipulation it requires (even if it makes some simple tasks much harder).

Well, I believe that is all for introductions. I am eagerly awaiting to find out what project I will be working on for the capstone course here at OSU, and will be posting updates on my project as the year progresses here on this blog.