Saturday, October 13, 2018

Started to Code the Decision Tree


After a couple of hours of coding and debugging I got the first little bit of the model decision tree to work and spit out buy and sell decisions. The output looks like this:

4895    6584.58008 1       0.00000 Stay long
4896    6653.29004 0       1.00000 R Sell Confirmed by pdD
4897    6676.62988 0       1.00000 Go long
4898    6677.93994 0       0.00000 Stay short
4899    6662.66016 0       0.00000 Stay short
4900    6708.49023 0       0.00000 Stay short

As the decision tree is far from complete, only the first two orders – long and then short – make any sense. The first number is a code for the date, the second is the closing value of the NASDAQ 100 index on the previous day (so that it's easier for me to work out where I am than the obscure date codes). Then there are codes for buy and sell and then a verbal description of the decision and why it was taken.

Luckily, writing computer code is a core practical skill for professional economists (or you should have these skills if you don't!) we took programming courses as part of our first year undergrad study.


No comments: