Building on my first attempt at building a bitcoin predictor, there’s a few things I’ve decided to change. Starting with keeping a record of the bitcoin trading info and saving the new one with the necessary created fields in a new file. I also changed the bitcoin_game so instead of asking for a start_index of which date to start with i.e. the row you use the date and it will match it with the row. The advantage is since editing the data frame might create NA’s and dropping the NA’s might lead to a shift in the expected index of the date so making it dynamic makes it simpler to run the game starting from a specific date.

So here’s the code for the new bitcoin game.

Also the other data frame had a predict column with the following value: 50,0, -50, -75 and -100 which at first was supposed to be in relative to the action taken in percentage withdraw/invest with a small but where 0 would be the equivalent of 100 and with no median of 0. With the new data frame I recreated the field with the range of 2 to -2 using the code below

As you can also tell the range of 2 as the highest sign of a positive trend and -4 as the clearest sign of a negative trend with 0 as the intermediate point where there’s likely a shift towards up or down.

To get the distribution of the values

df['Predict'].value_counts() >>> -2 1194 -1 666 2 627 0 405 1 14 Name: Predict, dtype: int64

Graphing the distribution

#make plot bigger plt.rcParams['figure.figsize'] = (20,10)

plt.plot(df2.index, df2['Value Norm'], c='g') plt.scatter(df2.index, df2['Predict'], c='b', alpha=0.3) plt.show()

Just for curiosity purposes to tell the distribution relative to the price normalized.

There’s more predictions of lows than ups, good thing is with the game I can simulate actual investment cycle and get back profit/loss which can be compared with the prediction and using this I can filter out the wrong predictions, key feature in making good investment ideas. I don’t predict the price, this predicts an expected upward or downward trend based on today’s price compared with data from the last 7 days. Here’s the code for the player that returns this info

First comparison of the last prediction which mainly would predict a profit as a loss as mainly -75 when there was a profit

player_1(miss_plot=True, miss_output=True, output=False) >>> profit day: 12/3/2010 profit: 2.29 loss: 0 amount: 980 invested: 80.4 predict: -75 profit day: 12/4/2010 profit: 1.13 loss: 0 amount: 1000 invested: 61.53 predict: -75 profit day: 12/8/2010 profit: 5.23 loss: 0 amount: 990 invested: 69.75 predict: -75 profit day: 12/12/2010 profit: 0.08 loss: 0 amount: 1010 invested: 46.24 predict: -75 profit day: 12/15/2010 profit: 3.41 loss: 0 amount: 910 invested: 150.16 predict: -75 profit day: 4/8/2011 profit: 2.38 loss: 0 amount: 1350 invested: 70.86 predict: -75 profit day: 4/11/2011 profit: 1.68 loss: 0 amount: 1380 invested: 39.21 predict: -75 profit day: 5/8/2011 profit: 16.52 loss: 0 amount: 1470 invested: 312.23 predict: -75 profit day: 9/3/2011 profit: 0.89 loss: 0 amount: 2260 invested: 46.23 predict: -75 profit day: 11/24/2011 profit: 2.14 loss: 0 amount: 2170 invested: 75.67 predict: -75 profit day: 12/10/2011 profit: 0.04 loss: 0 amount: 2180 invested: 89.28 predict: -75 profit day: 1/29/2012 profit: 0.07 loss: 0 amount: 2320 invested: 43.13 predict: -75 profit day: 3/4/2012 profit: 2.01 loss: 0 amount: 2290 invested: 62.1 predict: -75 profit day: 3/5/2012 profit: 1.77 loss: 0 amount: 2310 invested: 43.87 predict: -75 profit day: 3/28/2012 profit: 1.0 loss: 0 amount: 2300 invested: 55.7 predict: -75 profit day: 3/29/2012 profit: 0.17 loss: 0 amount: 2320 invested: 35.87 predict: -75 profit day: 7/27/2012 profit: 0.57 loss: 0 amount: 2350 invested: 111.54 predict: -75 profit day: 11/5/2012 profit: 1.14 loss: 0 amount: 2330 invested: 156.71 predict: -75 profit day: 1/4/2013 profit: 0.22 loss: 0 amount: 2380 invested: 122.42 predict: -75 profit day: 1/7/2013 profit: 0.07 loss: 0 amount: 2340 invested: 162.9 predict: -75 profit day: 3/13/2013 profit: 16.93 loss: 0 amount: 2400 invested: 424.44 predict: -75 profit day: 3/18/2013 profit: 1.58 loss: 0 amount: 2460 invested: 371.61 predict: -75 profit day: 4/13/2013 profit: 41.09 loss: 0 amount: 3340 invested: 116.29 predict: -75 profit day: 5/8/2013 profit: 5.79 loss: 0 amount: 3360 invested: 72.39 predict: -75 profit day: 6/1/2013 profit: 2.19 loss: 0 amount: 3320 invested: 122.37 predict: -75 profit day: 6/4/2013 profit: 0.3 loss: 0 amount: 3390 invested: 44.11 predict: -75 profit day: 6/5/2013 profit: 0.67 loss: 0 amount: 3380 invested: 54.78 predict: -75 profit day: 6/13/2013 profit: 0.45 loss: 0 amount: 3360 invested: 69.11 predict: -75 profit day: 6/15/2013 profit: 0.85 loss: 0 amount: 3370 invested: 54.25 predict: -75 profit day: 6/17/2013 profit: 0.17 loss: 0 amount: 3380 invested: 43.37 predict: -75 profit day: 6/18/2013 profit: 2.96 loss: 0 amount: 3370 invested: 56.33 predict: -75 profit day: 6/19/2013 profit: 0.23 loss: 0 amount: 3390 invested: 36.56 predict: -75 profit day: 7/10/2013 profit: 2.64 loss: 0 amount: 3340 invested: 71.62 predict: -75 profit day: 7/23/2013 profit: 4.38 loss: 0 amount: 3300 invested: 125.76 predict: -75 profit day: 8/9/2013 profit: 0.69 loss: 0 amount: 3290 invested: 146.35 predict: -75 profit day: 8/10/2013 profit: 0.45 loss: 0 amount: 3320 invested: 116.8 predict: -75 profit day: 8/11/2013 profit: 1.4 loss: 0 amount: 3350 invested: 88.2 predict: -75 profit day: 8/12/2013 profit: 0.97 loss: 0 amount: 3370 invested: 69.17 predict: -75 profit day: 8/16/2013 profit: 0.27 loss: 0 amount: 3350 invested: 84.95 predict: -75 profit day: 8/18/2013 profit: 0.42 loss: 0 amount: 3390 invested: 45.27 predict: -75 profit day: 8/19/2013 profit: 1.39 loss: 0 amount: 3380 invested: 56.66 predict: -75 profit day: 8/20/2013 profit: 1.4 loss: 0 amount: 3400 invested: 38.06 predict: -75 profit day: 10/3/2013 profit: 13.18 loss: 0 amount: 3350 invested: 93.49 predict: -75 profit day: 10/4/2013 profit: 4.04 loss: 0 amount: 3370 invested: 77.53 predict: -75 profit day: 10/6/2013 profit: 0.04 loss: 0 amount: 3410 invested: 37.26 predict: -75 profit day: 10/7/2013 profit: 0.61 loss: 0 amount: 3400 invested: 47.87 predict: -75 profit day: 10/8/2013 profit: 0.09 loss: 0 amount: 3390 invested: 57.96 predict: -75 profit day: 12/23/2013 profit: 0.26 loss: 0 amount: 4670 invested: 66.69 predict: -75 profit day: 12/24/2013 profit: 0.77 loss: 0 amount: 4690 invested: 47.46 predict: -75 profit day: 1/19/2014 profit: 3.18 loss: 0 amount: 4650 invested: 94.29 predict: -75 profit day: 1/29/2014 profit: 0.18 loss: 0 amount: 4690 invested: 51.56 predict: -75 profit day: 2/2/2014 profit: 0.62 loss: 0 amount: 4590 invested: 152.73 predict: -75 profit day: 3/13/2014 profit: 0.04 loss: 0 amount: 4660 invested: 63.83 predict: -75 profit day: 3/26/2014 profit: 0.69 loss: 0 amount: 4640 invested: 80.98 predict: -75 profit day: 4/5/2014 profit: 0.85 loss: 0 amount: 4660 invested: 45.58 predict: -75 profit day: 4/8/2014 profit: 2.19 loss: 0 amount: 4580 invested: 127.1 predict: -75 profit day: 4/11/2014 profit: 4.38 loss: 0 amount: 4650 invested: 49.48 predict: -75 profit day: 4/29/2014 profit: 0.09 loss: 0 amount: 4630 invested: 69.15 predict: -75 profit day: 4/30/2014 profit: 0.2 loss: 0 amount: 4650 invested: 49.35 predict: -75 profit day: 5/1/2014 profit: 1.21 loss: 0 amount: 4640 invested: 60.56 predict: -75 profit day: 5/4/2014 profit: 0.19 loss: 0 amount: 4640 invested: 57.97 predict: -75 profit day: 5/6/2014 profit: 0.22 loss: 0 amount: 4650 invested: 47.08 predict: -75 profit day: 5/7/2014 profit: 1.79 loss: 0 amount: 4640 invested: 58.87 predict: -75 profit day: 5/16/2014 profit: 0.14 loss: 0 amount: 4570 invested: 128.09 predict: -75 profit day: 6/18/2014 profit: 0.79 loss: 0 amount: 4670 invested: 78.34 predict: -75 profit day: 7/11/2014 profit: 1.61 loss: 0 amount: 4680 invested: 76.53 predict: -75 profit day: 7/12/2014 profit: 0.2 loss: 0 amount: 4700 invested: 56.73 predict: -75 profit day: 7/15/2014 profit: 0.03 loss: 0 amount: 4700 invested: 56.19 predict: -75 profit day: 7/18/2014 profit: 0.29 loss: 0 amount: 4610 invested: 146.53 predict: -75 profit day: 7/19/2014 profit: 0.25 loss: 0 amount: 4640 invested: 116.78 predict: -75 profit day: 7/22/2014 profit: 0.2 loss: 0 amount: 4710 invested: 45.03 predict: -75 profit day: 7/25/2014 profit: 0.36 loss: 0 amount: 4630 invested: 123.61 predict: -75 profit day: 8/8/2014 profit: 0.53 loss: 0 amount: 4590 invested: 161.88 predict: -75 profit day: 8/10/2014 profit: 0.09 loss: 0 amount: 4650 invested: 101.78 predict: -75 profit day: 8/29/2014 profit: 1.02 loss: 0 amount: 4570 invested: 170.79 predict: -75 profit day: 9/1/2014 profit: 0.97 loss: 0 amount: 4660 invested: 71.95 predict: -75 profit day: 9/2/2014 profit: 0.16 loss: 0 amount: 4680 invested: 52.11 predict: -75 profit day: 9/4/2014 profit: 0.87 loss: 0 amount: 4690 invested: 41.81 predict: -75 profit day: 12/1/2014 profit: 2.09 loss: 0 amount: 4620 invested: 108.26 predict: -75 profit day: 12/5/2014 profit: 0.9 loss: 0 amount: 4610 invested: 115.38 predict: -75 profit day: 12/6/2014 profit: 0.02 loss: 0 amount: 4640 invested: 85.4 predict: -75 profit day: 12/7/2014 profit: 0.38 loss: 0 amount: 4660 invested: 65.78 predict: -75 profit day: 12/10/2014 profit: 0.1 loss: 0 amount: 4690 invested: 32.33 predict: -75 profit day: 12/11/2014 profit: 0.47 loss: 0 amount: 4680 invested: 42.8 predict: -75 profit day: 12/28/2014 profit: 1.11 loss: 0 amount: 4630 invested: 85.43 predict: -75 profit day: 1/20/2015 profit: 0.2 loss: 0 amount: 4620 invested: 80.44 predict: -75 profit day: 1/21/2015 profit: 0.83 loss: 0 amount: 4640 invested: 61.27 predict: -75 profit day: 1/22/2015 profit: 5.32 loss: 0 amount: 4660 invested: 46.59 predict: -75 profit day: 2/7/2015 profit: 0.99 loss: 0 amount: 4640 invested: 57.31 predict: -75 profit day: 2/24/2015 profit: 1.4 loss: 0 amount: 4580 invested: 122.05 predict: -75 profit day: 3/28/2015 profit: 0.64 loss: 0 amount: 4680 invested: 35.7 predict: -75 profit day: 4/16/2015 profit: 2.65 loss: 0 amount: 4640 invested: 67.15 predict: -75 profit day: 4/30/2015 profit: 2.95 loss: 0 amount: 4620 invested: 83.52 predict: -75 profit day: 6/3/2015 profit: 0.68 loss: 0 amount: 4580 invested: 115.54 predict: -75 profit day: 6/6/2015 profit: 0.1 loss: 0 amount: 4650 invested: 44.74 predict: -75 profit day: 7/17/2015 profit: 1.01 loss: 0 amount: 4620 invested: 96.05 predict: -75 profit day: 7/18/2015 profit: 0.03 loss: 0 amount: 4640 invested: 76.08 predict: -75 profit day: 7/20/2015 profit: 0.44 loss: 0 amount: 4680 invested: 35.98 predict: -75 profit day: 7/21/2015 profit: 0.09 loss: 0 amount: 4670 invested: 46.07 predict: -75 profit day: 11/18/2015 profit: 1.51 loss: 0 amount: 4710 invested: 86.47 predict: -75 profit day: 12/22/2015 profit: 1.92 loss: 0 amount: 4650 invested: 186.71 predict: -75 profit day: 12/24/2015 profit: 1.93 loss: 0 amount: 4710 invested: 127.48 predict: -75 profit day: 12/26/2015 profit: 0.23 loss: 0 amount: 4730 invested: 111.33 predict: -75 profit day: 12/28/2015 profit: 0.08 loss: 0 amount: 4780 invested: 52.36 predict: -75 profit day: 12/29/2015 profit: 0.69 loss: 0 amount: 4800 invested: 33.05 predict: -75 profit day: 12/30/2015 profit: 0.56 loss: 0 amount: 4790 invested: 43.61 predict: -75 profit day: 1/1/2016 profit: 0.17 loss: 0 amount: 4800 invested: 33.46 predict: -75 profit day: 1/2/2016 profit: 0.23 loss: 0 amount: 4790 invested: 43.69 predict: -75 profit day: 1/28/2016 profit: 0.03 loss: 0 amount: 4690 invested: 136.68 predict: -75 profit day: 1/31/2016 profit: 0.18 loss: 0 amount: 4770 invested: 51.31 predict: -75 profit day: 2/8/2016 profit: 0.28 loss: 0 amount: 4700 invested: 121.51 predict: -75 profit day: 2/13/2016 profit: 2.17 loss: 0 amount: 4680 invested: 145.87 predict: -75 profit day: 2/28/2016 profit: 1.87 loss: 0 amount: 4730 invested: 115.26 predict: -75 profit day: 2/29/2016 profit: 0.39 loss: 0 amount: 4760 invested: 85.65 predict: -75 profit day: 3/1/2016 profit: 0.54 loss: 0 amount: 4780 invested: 66.19 predict: -75 profit day: 3/10/2016 profit: 0.11 loss: 0 amount: 4770 invested: 72.83 predict: -75 profit day: 3/11/2016 profit: 0.51 loss: 0 amount: 4790 invested: 53.34 predict: -75 profit day: 4/29/2016 profit: 0.96 loss: 0 amount: 4720 invested: 130.72 predict: -75 profit day: 5/2/2016 profit: 1.17 loss: 0 amount: 4770 invested: 81.66 predict: -75 profit day: 5/4/2016 profit: 0.96 loss: 0 amount: 4810 invested: 41.17 predict: -75 profit day: 5/6/2016 profit: 0.13 loss: 0 amount: 4810 invested: 40.97 predict: -75 profit day: 5/14/2016 profit: 0.8 loss: 0 amount: 4670 invested: 182.81 predict: -75 profit day: 5/16/2016 profit: 0.48 loss: 0 amount: 4730 invested: 122.82 predict: -75 profit day: 5/25/2016 profit: 0.58 loss: 0 amount: 4760 invested: 91.16 predict: -75 profit day: 5/26/2016 profit: 0.53 loss: 0 amount: 4780 invested: 71.69 predict: -75 profit day: 6/25/2016 profit: 10.73 loss: 0 amount: 4710 invested: 206.54 predict: -75 profit day: 6/26/2016 profit: 1.34 loss: 0 amount: 4750 invested: 167.88 predict: -75 profit day: 6/28/2016 profit: 3.95 loss: 0 amount: 4810 invested: 102.36 predict: -75 profit day: 7/9/2016 profit: 4.29 loss: 0 amount: 4820 invested: 92.02 predict: -75 profit day: 7/29/2016 profit: 0.03 loss: 0 amount: 4850 invested: 59.72 predict: -75 profit day: 8/8/2016 profit: 0.58 loss: 0 amount: 4830 invested: 66.89 predict: -75 profit day: 8/21/2016 profit: 0.61 loss: 0 amount: 4830 invested: 64.56 predict: -75 profit day: 9/14/2016 profit: 0.26 loss: 0 amount: 4760 invested: 136.51 predict: -75 profit day: 9/15/2016 profit: 0.26 loss: 0 amount: 4790 invested: 106.77 predict: -75 profit day: 11/6/2016 profit: 0.37 loss: 0 amount: 4670 invested: 247.37 predict: -75 profit day: 11/9/2016 profit: 1.59 loss: 0 amount: 4720 invested: 199.08 predict: -75 profit day: 11/10/2016 profit: 3.36 loss: 0 amount: 4750 invested: 172.44 predict: -75 profit day: 11/26/2016 profit: 0.65 loss: 0 amount: 4740 invested: 186.59 predict: -75 profit day: 12/10/2016 profit: 0.07 loss: 0 amount: 4750 invested: 178.42 predict: -75 profit day: 1/8/2017 profit: 3.12 loss: 0 amount: 4790 invested: 163.57 predict: -75 profit day: 1/9/2017 profit: 2.06 loss: 0 amount: 4820 invested: 135.63 predict: -75 profit day: 1/11/2017 profit: 1.37 loss: 0 amount: 4880 invested: 74.92 predict: -75 profit day: 1/13/2017 profit: 1.04 loss: 0 amount: 4890 invested: 55.97 predict: -75 profit day: 1/14/2017 profit: 1.6 loss: 0 amount: 4910 invested: 37.57 predict: -75 profit day: 1/16/2017 profit: 0.25 loss: 0 amount: 4890 invested: 57.44 predict: -75 profit day: 1/17/2017 profit: 0.58 loss: 0 amount: 4910 invested: 38.02 predict: -75 profit day: 1/18/2017 profit: 3.36 loss: 0 amount: 4900 invested: 51.38 predict: -75 profit day: 1/29/2017 profit: 0.21 loss: 0 amount: 4760 invested: 197.14 predict: -75 profit day: 1/31/2017 profit: 0.95 loss: 0 amount: 4820 invested: 137.15 predict: -75 profit day: 2/11/2017 profit: 3.85 loss: 0 amount: 4830 invested: 137.17 predict: -75 profit day: 2/12/2017 profit: 1.34 loss: 0 amount: 4860 invested: 108.51 predict: -75 profit day: 2/15/2017 profit: 0.69 loss: 0 amount: 4930 invested: 38.25 predict: -75 profit day: 2/16/2017 profit: 0.02 loss: 0 amount: 4920 invested: 48.27 predict: -75 profit day: 3/10/2017 profit: 3.84 loss: 0 amount: 4890 invested: 100.65 predict: -75 profit day: 3/12/2017 profit: 4.6 loss: 0 amount: 4940 invested: 47.33 predict: -75 profit day: 3/13/2017 profit: 1.94 loss: 0 amount: 4930 invested: 59.27 predict: -75 profit day: 3/14/2017 profit: 0.59 loss: 0 amount: 4950 invested: 39.86 predict: -75 profit day: 3/20/2017 profit: 5.37 loss: 0 amount: 4910 invested: 51.24 predict: -75 profit day: 3/21/2017 profit: 0.96 loss: 0 amount: 4930 invested: 32.2 predict: -75 profit day: 3/22/2017 profit: 2.13 loss: 0 amount: 4920 invested: 44.33 predict: -75 profit day: 3/24/2017 profit: 0.5 loss: 0 amount: 4930 invested: 31.27 predict: -75 profit day: 3/28/2017 profit: 12.52 loss: 0 amount: 4840 invested: 131.45 predict: -75 profit day: 3/29/2017 profit: 1.13 loss: 0 amount: 4870 invested: 102.58 predict: -75 profit day: 4/18/2017 profit: 0.93 loss: 0 amount: 4920 invested: 69.73 predict: -75 profit day: 4/19/2017 profit: 0.61 loss: 0 amount: 4940 invested: 50.34 predict: -75 profit day: 4/20/2017 profit: 0.07 loss: 0 amount: 4960 invested: 30.41 predict: -75 profit day: 6/1/2017 profit: 8.41 loss: 0 amount: 4780 invested: 371.2 predict: -75 profit day: 6/14/2017 profit: 14.9 loss: 0 amount: 4810 invested: 412.28 predict: -75 profit day: 6/17/2017 profit: 2.64 loss: 0 amount: 4930 invested: 249.13 predict: -75 profit day: 6/18/2017 profit: 20.31 loss: 0 amount: 4970 invested: 229.44 predict: -75 profit day: 6/20/2017 profit: 7.7 loss: 0 amount: 5040 invested: 153.5 predict: -75 profit day: 7/12/2017 profit: 0.26 loss: 0 amount: 5050 invested: 136.62 predict: -75 profit day: 7/13/2017 profit: 0.92 loss: 0 amount: 5080 invested: 107.54 predict: -75 profit day: 9/6/2017 profit: 6.5 loss: 0 amount: 5120 invested: 171.82 predict: -75 profit day: 9/8/2017 profit: 0.41 loss: 0 amount: 5140 invested: 158.09 predict: -75 profit day: 9/10/2017 profit: 1.75 loss: 0 amount: 5200 invested: 88.16 predict: -75 profit day: 12/27/2017 profit: 15.51 loss: 0 amount: 5450 invested: 141.98 predict: -75 profit day: 12/30/2017 profit: 1.26 loss: 0 amount: 5530 invested: 51.2 predict: -75 profit day: 1/4/2018 profit: 0.38 loss: 0 amount: 5460 invested: 129.38 predict: -75 profit day: 1/16/2018 profit: 1.78 loss: 0 amount: 5460 invested: 126.8 predict: -75 profit day: 1/19/2018 profit: 1.04 loss: 0 amount: 5530 invested: 31.81 predict: -75 profit day: 1/20/2018 profit: 0.22 loss: 0 amount: 5520 invested: 42.03 predict: -75 profit day: 1/21/2018 profit: 5.62 loss: 0 amount: 5510 invested: 57.65 predict: -75 profit day: 2/9/2018 profit: 0.93 loss: 0 amount: 5470 invested: 64.5 predict: -75 profit day: 2/10/2018 profit: 2.31 loss: 0 amount: 5490 invested: 46.81 predict: -75 profit day: 2/12/2018 profit: 0.16 loss: 0 amount: 5500 invested: 35.79 predict: -75 profit day: 3/20/2018 profit: 1.46 loss: 0 amount: 5470 invested: 61.04 predict: -75 profit day: 3/21/2018 profit: 4.17 loss: 0 amount: 5490 invested: 45.21 predict: -75 profit day: 4/4/2018 profit: 2.92 loss: 0 amount: 5460 invested: 67.76 predict: -75 profit day: 4/6/2018 profit: 0.24 loss: 0 amount: 5470 invested: 52.31 predict: -75 profit day: 4/8/2018 profit: 1.5 loss: 0 amount: 5480 invested: 42.1 predict: -75 profit day: 4/11/2018 profit: 1.98 loss: 0 amount: 5400 invested: 122.24 predict: -75 profit day: 6/12/2018 profit: 1.37 loss: 0 amount: 5460 invested: 75.16 predict: -75 Reached the final day, game ending day: 7/22/2018 profit: 0 loss: 2.04 amount: 5330 invested: 200.41

And the new predict column

player_1(miss_plot=True, miss_output=True, output=False) >>> loss day: 9/10/2010 profit: 0 loss: 0.4 amount: 940 invested: 53.47 predict: 0 loss day: 10/12/2010 profit: 0 loss: 14.21 amount: 1000 invested: 55.25 predict: 0 loss day: 11/1/2010 profit: 0 loss: 0.61 amount: 1090 invested: 90.96 predict: 0 loss day: 11/8/2010 profit: 0 loss: 27.42 amount: 1160 invested: 88.06 predict: 0 loss day: 12/30/2010 profit: 0 loss: 0.33 amount: 1140 invested: 109.47 predict: 0 loss day: 1/15/2011 profit: 0 loss: 4.31 amount: 1230 invested: 44.52 predict: 0 loss day: 2/2/2011 profit: 0 loss: 10.07 amount: 1250 invested: 86.96 predict: 0 loss day: 3/27/2011 profit: 0 loss: 0.46 amount: 1300 invested: 54.35 predict: 0 loss day: 5/1/2011 profit: 0 loss: 1.12 amount: 1380 invested: 86.26 predict: 0 loss day: 5/2/2011 profit: 0 loss: 12.55 amount: 1370 invested: 83.71 predict: 0 loss day: 5/15/2011 profit: 0 loss: 2.73 amount: 1440 invested: 76.66 predict: 0 loss day: 5/27/2011 profit: 0 loss: 8.21 amount: 1360 invested: 188.65 predict: 0 loss day: 6/28/2011 profit: 0 loss: 4.0 amount: 1460 invested: 155.89 predict: 0 loss day: 12/12/2011 profit: 0 loss: 1.08 amount: 1310 invested: 106.14 predict: 0 loss day: 12/21/2011 profit: 0 loss: 5.11 amount: 1360 invested: 63.85 predict: 0 loss day: 2/25/2012 profit: 0 loss: 2.84 amount: 1310 invested: 122.8 predict: 0 loss day: 3/9/2012 profit: 0 loss: 0.66 amount: 1380 invested: 55.05 predict: 0 loss day: 3/16/2012 profit: 0 loss: 0.73 amount: 1360 invested: 88.72 predict: 0 loss day: 4/22/2012 profit: 0 loss: 1.0 amount: 1400 invested: 45.07 predict: 0 loss day: 6/10/2012 profit: 0 loss: 0.57 amount: 1400 invested: 50.11 predict: 0 loss day: 6/17/2012 profit: 0 loss: 0.61 amount: 1390 invested: 67.74 predict: 0 loss day: 7/14/2012 profit: 0 loss: 1.09 amount: 1420 invested: 49.6 predict: 0 loss day: 8/18/2012 profit: 0 loss: 0.35 amount: 1460 invested: 48.42 predict: 0 loss day: 9/8/2012 profit: 0 loss: 0.49 amount: 1430 invested: 78.41 predict: 0 loss day: 9/21/2012 profit: 0 loss: 0.32 amount: 1470 invested: 44.11 predict: 0 loss day: 10/5/2012 profit: 0 loss: 0.29 amount: 1470 invested: 47.75 predict: 0 loss day: 10/6/2012 profit: 0 loss: 0.33 amount: 1460 invested: 57.42 predict: 0 loss day: 11/27/2012 profit: 0 loss: 0.31 amount: 1480 invested: 42.35 predict: 0 loss day: 12/15/2012 profit: 0 loss: 0.34 amount: 1480 invested: 46.5 predict: 0 loss day: 1/1/2013 profit: 0 loss: 0.12 amount: 1460 invested: 66.94 predict: 0 loss day: 1/13/2013 profit: 0 loss: 0.15 amount: 1460 invested: 69.5 predict: 0 loss day: 1/25/2013 profit: 0 loss: 0.85 amount: 1490 invested: 54.97 predict: 0 loss day: 2/1/2013 profit: 0 loss: 0.37 amount: 1480 invested: 71.38 predict: 0 loss day: 3/2/2013 profit: 0 loss: 0.7 amount: 1530 invested: 44.56 predict: 0 loss day: 3/15/2013 profit: 0 loss: 0.02 amount: 1550 invested: 43.88 predict: 0 loss day: 3/22/2013 profit: 0 loss: 2.12 amount: 1540 invested: 75.96 predict: 0 loss day: 4/25/2013 profit: 0 loss: 1.5 amount: 1650 invested: 118.9 predict: 0 loss day: 5/18/2013 profit: 0 loss: 0.3 amount: 1700 invested: 59.62 predict: 0 loss day: 5/27/2013 profit: 0 loss: 0.57 amount: 1700 invested: 62.69 predict: 0 loss day: 6/21/2013 profit: 0 loss: 0.42 amount: 1690 invested: 57.52 predict: 0 loss day: 6/22/2013 profit: 0 loss: 0.99 amount: 1680 invested: 66.53 predict: 0 loss day: 7/13/2013 profit: 0 loss: 2.15 amount: 1610 invested: 124.26 predict: 0 loss day: 9/3/2013 profit: 0 loss: 0.16 amount: 1710 invested: 46.88 predict: 0 loss day: 9/13/2013 profit: 0 loss: 0.07 amount: 1690 invested: 68.41 predict: 0 loss day: 10/24/2013 profit: 0 loss: 0.83 amount: 1730 invested: 49.06 predict: 0 loss day: 11/24/2013 profit: 0 loss: 0.23 amount: 1810 invested: 49.26 predict: 0 loss day: 12/27/2013 profit: 0 loss: 1.18 amount: 1810 invested: 54.74 predict: 0 loss day: 1/7/2014 profit: 0 loss: 3.48 amount: 1820 invested: 55.22 predict: 0 loss day: 1/8/2014 profit: 0 loss: 2.68 amount: 1810 invested: 62.54 predict: 0 loss day: 2/3/2014 profit: 0 loss: 0.27 amount: 1830 invested: 47.43 predict: 0 loss day: 3/14/2014 profit: 0 loss: 0.7 amount: 1780 invested: 82.78 predict: 0 loss day: 5/17/2014 profit: 0 loss: 0.06 amount: 1810 invested: 49.07 predict: 0 loss day: 5/27/2014 profit: 0 loss: 0.16 amount: 1820 invested: 52.43 predict: 0 loss day: 6/19/2014 profit: 0 loss: 0.03 amount: 1810 invested: 55.24 predict: 0 loss day: 6/20/2014 profit: 0 loss: 1.0 amount: 1800 invested: 64.24 predict: 0 loss day: 7/2/2014 profit: 0 loss: 0.1 amount: 1730 invested: 150.67 predict: 0 loss day: 7/13/2014 profit: 0 loss: 0.15 amount: 1800 invested: 77.03 predict: 0 loss day: 11/13/2014 profit: 0 loss: 3.64 amount: 1750 invested: 73.01 predict: 0 loss day: 12/24/2014 profit: 0 loss: 2.19 amount: 1720 invested: 86.41 predict: 0 loss day: 1/27/2015 profit: 0 loss: 0.98 amount: 1710 invested: 57.83 predict: 0 loss day: 5/4/2015 profit: 0 loss: 0.63 amount: 1720 invested: 44.13 predict: 0 loss day: 6/18/2015 profit: 0 loss: 0.41 amount: 1700 invested: 68.82 predict: 0 loss day: 6/19/2015 profit: 0 loss: 0.5 amount: 1690 invested: 78.32 predict: 0 loss day: 7/1/2015 profit: 0 loss: 0.98 amount: 1710 invested: 63.89 predict: 0 loss day: 7/15/2015 profit: 0 loss: 0.32 amount: 1720 invested: 58.78 predict: 0 loss day: 7/22/2015 profit: 0 loss: 0.5 amount: 1690 invested: 86.89 predict: 0 loss day: 9/10/2015 profit: 0 loss: 0.71 amount: 1690 invested: 66.96 predict: 0 loss day: 10/18/2015 profit: 0 loss: 0.83 amount: 1720 invested: 42.88 predict: 0 loss day: 11/6/2015 profit: 0 loss: 3.29 amount: 1740 invested: 45.51 predict: 0 loss day: 11/7/2015 profit: 0 loss: 1.32 amount: 1730 invested: 54.19 predict: 0 loss day: 12/17/2015 profit: 0 loss: 0.65 amount: 1730 invested: 68.86 predict: 0 loss day: 1/6/2016 profit: 0 loss: 0.1 amount: 1750 invested: 49.19 predict: 0 loss day: 3/2/2016 profit: 0 loss: 0.31 amount: 1760 invested: 41.05 predict: 0 loss day: 3/3/2016 profit: 0 loss: 0.18 amount: 1750 invested: 50.87 predict: 0 loss day: 5/17/2016 profit: 0 loss: 0.26 amount: 1760 invested: 44.74 predict: 0 loss day: 6/29/2016 profit: 0 loss: 0.08 amount: 1720 invested: 119.78 predict: 0 loss day: 8/9/2016 profit: 0 loss: 0.2 amount: 1770 invested: 65.81 predict: 0 loss day: 8/24/2016 profit: 0 loss: 0.31 amount: 1760 invested: 74.73 predict: 0 loss day: 11/24/2016 profit: 0 loss: 0.41 amount: 1800 invested: 52.41 predict: 0 loss day: 12/25/2016 profit: 0 loss: 0.37 amount: 1820 invested: 44.2 predict: 0 loss day: 4/5/2017 profit: 0 loss: 0.01 amount: 1830 invested: 66.42 predict: 0 loss day: 7/7/2017 profit: 0 loss: 0.16 amount: 1890 invested: 55.69 predict: 0 loss day: 8/2/2017 profit: 0 loss: 4.73 amount: 1880 invested: 92.13 predict: 0 loss day: 8/18/2017 profit: 0 loss: 0.36 amount: 1940 invested: 58.2 predict: 0 loss day: 8/27/2017 profit: 0 loss: 0.04 amount: 1930 invested: 73.37 predict: 0 loss day: 10/18/2017 profit: 0 loss: 0.7 amount: 1980 invested: 46.46 predict: 0 loss day: 11/6/2017 profit: 0 loss: 0.39 amount: 1990 invested: 57.68 predict: 0 loss day: 12/9/2017 profit: 0 loss: 1.78 amount: 2030 invested: 67.5 predict: 0 loss day: 12/10/2017 profit: 0 loss: 3.65 amount: 2020 invested: 73.85 predict: 0 loss day: 1/8/2018 profit: 0 loss: 2.67 amount: 2050 invested: 76.58 predict: 0 loss day: 3/22/2018 profit: 0 loss: 0.49 amount: 1970 invested: 122.01 predict: 0 loss day: 4/17/2018 profit: 0 loss: 2.14 amount: 2000 invested: 67.9 predict: 0 loss day: 5/7/2018 profit: 0 loss: 1.16 amount: 2010 invested: 74.49 predict: 0 loss day: 5/8/2018 profit: 0 loss: 2.2 amount: 2000 invested: 82.29 predict: 0 loss day: 7/27/2018 profit: 0 loss: 0.39 amount: 2000 invested: 60.18 predict: 0 Reached the final day, game ending day: 8/6/2018 profit: 0 loss: 4.59 amount: 1910 invested: 133.72

This only predicts a profit when there was a loss at the edge of profit and loss: predict value of 0.

My final step for now is to see how well two ML predictors are at deducing the same.

This performed as poorly with the other dataframe then there’s random forest

It performed less than on the other data frame with .97 i.e. 97% accuracy and this time 80% accuracy but with this prediction column there’s more accuracy and in the last I used an else for anything that didn’t match any of the if statements with a default prediction of 50, this one without such a clause has more of that *what if *problem scenarios and so if in the same sense the classifier is likely to miss out with a wrong prediction in the 0 columns. I could make another prediction without the 0 predictions to confirm my hunch but I’m satisfied for now with this.

I also added a double check clause that keeps track of the predictions above the bitcoin game and player_1 records the profit/loss or no change in price in this categories of 2 to -2 and this is the final result of the spread.

predictions >>> {-2: {'draw': 24, 'loss': 459, 'profit': 711}, -1: {'draw': 15, 'loss': 398, 'profit': 252}, 0: {'draw': 3, 'loss': 95, 'profit': 307}, 1: {'draw': 1, 'loss': 4, 'profit': 9}, 2: {'draw': 12, 'loss': 396, 'profit': 219}}

Graphing this also comes out like this

df2 = pd.DataFrame(predictions)

#Flip columns and rows df3 = df2.T df3.plot(kind='bar')

My predictor has the highest profit and loss for -2 *“far left columns” *and to the far right 2. Red is “draw”, blue is “loss” and the purplish is “profit”.

One more unexpected observation is the first round with the cab starting from date: 10–9–2010 player_2 made $20.5 million total on the second try with a start date of 8–29–2010 the total amount was $15.7 million, less when it starting with an earlier date than the first try. This felt like maybe the edited code might have made an unexpected bug but doing the same with the older version of player_2 with the newer dataframe returned the same result.

The reason for this I concluded was the function suffers from the chaos theory where a slight change in the initial settings can lead to different results. You’d expect investing earlier and wisely this function would always outperform any other iteration starting later but because it makes a move: withdrawal/investment as a fraction of amount existing this creates a diversion that can go either way but generally for the better.

If intrinsically the stock market seems a bit chaotic and this seema to reap rewards I’m eager to try it on other stocks and learn some more.