diff --git a/100btdusd_2020-01-01_to_2020-06-06_predicted_to_2020-12-31.csv b/100btdusd_2020-01-01_to_2020-06-06_predicted_to_2020-12-31.csv new file mode 100644 index 00000000..a8d65866 --- /dev/null +++ b/100btdusd_2020-01-01_to_2020-06-06_predicted_to_2020-12-31.csv @@ -0,0 +1,208 @@ +2020-06-07;9796,00;9416,88;9621,40;9581,59;27,18; +2020-06-08;9781,92;9367,07;9581,59;9558,51;35,11; +2020-06-09;9739,93;9349,51;9558,51;9553,96;49,12; +2020-06-10;9769,32;9365,60;9553,96;9583,19;63,07; +2020-06-11;9769,35;9386,12;9583,19;9571,83;67,02; +2020-06-12;9756,88;9365,87;9571,83;9551,87;73,79; +2020-06-13;9748,66;9361,98;9551,87;9569,57;74,12; +2020-06-14;9757,02;9305,32;9569,57;9500,10;95,94; +2020-06-15;9707,42;9299,83;9500,10;9511,20;102,34; +2020-06-16;9708,29;9308,87;9511,20;9509,58;113,13; +2020-06-17;9710,14;9335,13;9509,58;9544,84;122,33; +2020-06-18;9727,75;9355,18;9544,84;9548,09;132,05; +2020-06-19;9752,19;9361,23;9548,09;9558,86;132,26; +2020-06-20;9779,01;9379,17;9558,86;9581,89;133,34; +2020-06-21;9790,34;9403,65;9581,89;9605,63;135,61; +2020-06-22;9799,97;9421,14;9605,63;9617,87;136,73; +2020-06-23;9812,74;9416,27;9617,87;9609,30;149,46; +2020-06-24;9820,95;9435,80;9609,30;9634,52;155,59; +2020-06-25;9847,19;9438,48;9634,52;9641,83;155,36; +2020-06-26;9840,46;9459,97;9641,83;9676,80;158,61; +2020-06-27;9879,76;9480,17;9676,80;9684,30;159,79; +2020-06-28;9864,85;9477,26;9684,30;9679,40;155,40; +2020-06-29;9879,56;9485,64;9679,40;9683,98;157,15; +2020-06-30;9895,83;9484,82;9683,98;9690,69;164,92; +2020-07-01;9884,40;9485,22;9690,69;9675,39;166,61; +2020-07-02;9853,94;9495,76;9675,39;9667,94;161,18; +2020-07-03;9849,89;9446,26;9667,94;9621,72;169,11; +2020-07-04;9800,55;9422,16;9621,72;9609,26;179,67; +2020-07-05;9820,20;9398,55;9609,26;9616,89;190,71; +2020-07-06;9812,96;9406,99;9616,89;9608,89;186,71; +2020-07-07;9803,66;9417,95;9608,89;9604,63;190,48; +2020-07-08;9822,01;9427,22;9604,63;9639,84;208,44; +2020-07-09;9831,87;9440,98;9639,84;9627,94;211,35; +2020-07-10;9850,28;9414,72;9627,94;9634,54;219,67; +2020-07-11;9823,39;9433,73;9634,54;9609,15;235,00; +2020-07-12;9782,95;9390,61;9609,15;9583,42;239,04; +2020-07-13;9786,73;9421,19;9583,42;9619,57;238,00; +2020-07-14;9817,38;9426,52;9619,57;9610,68;247,39; +2020-07-15;9797,09;9415,35;9610,68;9592,90;252,03; +2020-07-16;9789,13;9402,49;9592,90;9613,07;264,34; +2020-07-17;9812,08;9423,66;9613,07;9640,29;272,66; +2020-07-18;9863,30;9444,64;9640,29;9668,73;278,53; +2020-07-19;9871,92;9492,65;9668,73;9683,16;288,92; +2020-07-20;9867,73;9473,57;9683,16;9673,07;295,72; +2020-07-21;9917,12;9494,06;9673,07;9721,58;285,19; +2020-07-22;9917,29;9531,33;9721,58;9720,49;278,56; +2020-07-23;9941,11;9530,49;9720,49;9747,74;276,39; +2020-07-24;9947,49;9542,00;9747,74;9751,59;289,91; +2020-07-25;9949,07;9542,31;9751,59;9731,98;294,12; +2020-07-26;9911,83;9501,19;9731,98;9680,00;292,00; +2020-07-27;9868,62;9469,90;9680,00;9656,83;294,46; +2020-07-28;9850,34;9464,50;9656,83;9647,77;302,27; +2020-07-29;9846,67;9467,35;9647,77;9656,87;311,24; +2020-07-30;9858,09;9458,42;9656,87;9664,65;298,34; +2020-07-31;9859,54;9483,92;9664,65;9666,78;306,72; +2020-08-01;9869,73;9465,83;9666,78;9654,11;310,37; +2020-08-02;9854,31;9456,72;9654,11;9658,73;326,95; +2020-08-03;9857,25;9434,08;9658,73;9621,42;326,38; +2020-08-04;9817,29;9444,74;9621,42;9626,41;334,39; +2020-08-05;9814,58;9435,11;9626,41;9627,46;338,04; +2020-08-06;9833,69;9442,96;9627,46;9635,75;333,91; +2020-08-07;9840,19;9431,00;9635,75;9657,22;341,98; +2020-08-08;9844,64;9468,97;9657,22;9652,99;353,11; +2020-08-09;9841,66;9453,92;9652,99;9653,23;354,64; +2020-08-10;9859,11;9459,12;9653,23;9669,01;353,27; +2020-08-11;9882,56;9494,46;9669,01;9707,75;352,29; +2020-08-12;9902,15;9520,80;9707,75;9719,41;354,85; +2020-08-13;9898,19;9488,78;9719,41;9671,25;361,24; +2020-08-14;9855,70;9514,86;9671,25;9692,89;369,68; +2020-08-15;9871,17;9489,48;9692,89;9656,32;369,00; +2020-08-16;9860,76;9456,76;9656,32;9647,84;367,77; +2020-08-17;9846,15;9453,12;9647,84;9649,82;369,16; +2020-08-18;9856,43;9458,28;9649,82;9664,20;379,66; +2020-08-19;9862,36;9452,09;9664,20;9641,18;389,56; +2020-08-20;9835,29;9456,87;9641,18;9656,02;402,33; +2020-08-21;9859,21;9452,36;9656,02;9647,76;398,76; +2020-08-22;9838,59;9424,60;9647,76;9630,32;408,49; +2020-08-23;9820,06;9401,57;9630,32;9610,01;412,75; +2020-08-24;9808,17;9426,68;9610,01;9628,32;410,01; +2020-08-25;9857,55;9453,02;9628,32;9670,38;415,87; +2020-08-26;9879,54;9475,33;9670,38;9684,29;417,04; +2020-08-27;9875,40;9492,36;9684,29;9683,66;426,11; +2020-08-28;9854,91;9472,70;9683,66;9657,17;429,13; +2020-08-29;9876,79;9463,78;9657,17;9678,05;427,57; +2020-08-30;9869,22;9474,71;9678,05;9657,92;431,15; +2020-08-31;9874,37;9464,82;9657,92;9679,18;433,03; +2020-09-01;9885,67;9494,13;9679,18;9692,40;431,88; +2020-09-02;9914,88;9510,24;9692,40;9702,22;433,79; +2020-09-03;9878,11;9487,06;9702,22;9661,35;431,21; +2020-09-04;9856,68;9441,82;9661,35;9635,28;429,96; +2020-09-05;9816,26;9411,61;9635,28;9599,87;422,72; +2020-09-06;9800,85;9409,54;9599,87;9609,19;417,26; +2020-09-07;9831,99;9419,51;9609,19;9622,28;422,80; +2020-09-08;9839,11;9429,82;9622,28;9632,10;424,92; +2020-09-09;9832,85;9438,82;9632,10;9647,69;426,58; +2020-09-10;9865,22;9476,61;9647,69;9704,98;415,45; +2020-09-11;9900,61;9506,74;9704,98;9697,39;428,46; +2020-09-12;9872,31;9479,85;9697,39;9645,85;442,70; +2020-09-13;9828,44;9426,44;9645,85;9609,41;449,12; +2020-09-14;9809,25;9411,49;9609,41;9626,11;449,83; +2020-09-15;9826,69;9409,30;9626,11;9607,75;458,78; +2020-09-16;9790,13;9434,02;9607,75;9608,33;464,82; +2020-09-17;9791,17;9388,92;9608,33;9574,99;459,43; +2020-09-18;9786,48;9390,99;9574,99;9593,90;468,16; +2020-09-19;9774,80;9398,38;9593,90;9579,87;477,48; +2020-09-20;9782,28;9349,29;9579,87;9584,74;480,69; +2020-09-21;9797,53;9416,58;9584,74;9620,58;489,48; +2020-09-22;9796,71;9406,61;9620,58;9595,37;490,25; +2020-09-23;9799,08;9387,25;9595,37;9593,85;481,92; +2020-09-24;9790,07;9398,83;9593,85;9607,49;487,97; +2020-09-25;9808,54;9385,20;9607,49;9593,89;481,61; +2020-09-26;9787,05;9410,78;9593,89;9601,70;497,10; +2020-09-27;9793,27;9399,04;9601,70;9589,90;498,87; +2020-09-28;9788,31;9380,75;9589,90;9579,99;499,38; +2020-09-29;9792,92;9392,79;9579,99;9595,14;506,64; +2020-09-30;9804,86;9378,11;9595,14;9588,72;508,10; +2020-10-01;9787,02;9397,83;9588,72;9592,64;514,67; +2020-10-02;9792,51;9382,90;9592,64;9578,33;514,56; +2020-10-03;9747,70;9379,58;9578,33;9531,49;516,35; +2020-10-04;9739,85;9374,00;9531,49;9556,28;517,59; +2020-10-05;9749,07;9387,32;9556,28;9576,94;520,07; +2020-10-06;9806,54;9392,98;9576,94;9620,40;517,89; +2020-10-07;9826,25;9452,62;9620,40;9659,97;518,19; +2020-10-08;9876,19;9485,48;9659,97;9685,44;513,00; +2020-10-09;9876,44;9489,13;9685,44;9672,91;508,40; +2020-10-10;9881,51;9470,68;9672,91;9666,12;512,66; +2020-10-11;9840,72;9446,81;9666,12;9631,83;520,46; +2020-10-12;9814,01;9420,02;9631,83;9607,29;525,60; +2020-10-13;9802,72;9419,98;9607,29;9615,34;531,09; +2020-10-14;9812,51;9452,87;9615,34;9638,52;524,85; +2020-10-15;9857,75;9456,79;9638,52;9691,06;526,29; +2020-10-16;9873,17;9507,83;9691,06;9698,68;537,30; +2020-10-17;9882,52;9488,56;9698,68;9682,51;537,68; +2020-10-18;9848,56;9482,38;9682,51;9654,39;547,67; +2020-10-19;9853,16;9474,15;9654,39;9670,58;558,98; +2020-10-20;9856,53;9464,98;9670,58;9666,83;556,64; +2020-10-21;9863,04;9482,62;9666,83;9688,73;556,23; +2020-10-22;9874,37;9474,47;9688,73;9681,58;556,98; +2020-10-23;9882,96;9447,23;9681,58;9639,74;565,17; +2020-10-24;9815,25;9443,30;9639,74;9616,83;571,89; +2020-10-25;9799,37;9384,92;9616,83;9587,48;571,64; +2020-10-26;9789,35;9391,49;9587,48;9579,84;565,10; +2020-10-27;9784,22;9413,97;9579,84;9599,91;549,33; +2020-10-28;9762,68;9362,01;9599,91;9543,82;553,94; +2020-10-29;9743,32;9345,71;9543,82;9542,24;553,70; +2020-10-30;9772,10;9370,45;9542,24;9601,58;568,56; +2020-10-31;9809,30;9401,37;9601,58;9605,08;557,38; +2020-11-01;9787,95;9411,14;9605,08;9603,24;554,85; +2020-11-02;9826,51;9389,26;9603,24;9605,67;569,10; +2020-11-03;9792,64;9406,08;9605,67;9578,97;578,93; +2020-11-04;9758,11;9376,13;9578,97;9568,56;584,07; +2020-11-05;9761,61;9382,09;9568,56;9576,13;589,71; +2020-11-06;9760,10;9383,89;9576,13;9574,46;576,43; +2020-11-07;9800,53;9400,67;9574,46;9609,69;573,65; +2020-11-08;9827,47;9453,67;9609,69;9655,79;566,59; +2020-11-09;9863,96;9485,17;9655,79;9695,34;571,22; +2020-11-10;9870,83;9479,47;9695,34;9663,29;566,16; +2020-11-11;9859,79;9480,37;9663,29;9670,58;577,21; +2020-11-12;9858,82;9494,96;9670,58;9670,51;574,22; +2020-11-13;9866,39;9470,14;9670,51;9669,07;576,70; +2020-11-14;9866,14;9466,86;9669,07;9674,60;574,88; +2020-11-15;9859,98;9476,99;9674,60;9662,07;575,24; +2020-11-16;9887,97;9483,02;9662,07;9700,07;568,33; +2020-11-17;9915,89;9529,33;9700,07;9749,63;569,63; +2020-11-18;9946,18;9553,67;9749,63;9745,53;557,87; +2020-11-19;9941,97;9534,38;9745,53;9737,23;559,38; +2020-11-20;9963,81;9555,92;9737,23;9770,25;555,10; +2020-11-21;9969,68;9582,74;9770,25;9790,25;558,89; +2020-11-22;9971,10;9591,90;9790,25;9770,55;562,35; +2020-11-23;9962,69;9575,90;9770,55;9758,30;569,16; +2020-11-24;9958,93;9570,22;9758,30;9759,21;565,94; +2020-11-25;9981,56;9569,61;9759,21;9778,21;569,88; +2020-11-26;9981,26;9568,60;9778,21;9784,63;570,80; +2020-11-27;9978,88;9576,85;9784,63;9773,69;578,10; +2020-11-28;9974,52;9624,88;9773,69;9805,71;574,26; +2020-11-29;10014,25;9620,44;9805,71;9831,86;578,92; +2020-11-30;10026,56;9623,68;9831,86;9842,61;568,84; +2020-12-01;10011,28;9587,78;9842,61;9759,98;558,83; +2020-12-02;9960,39;9537,02;9759,98;9767,01;555,32; +2020-12-03;9945,25;9538,52;9767,01;9725,45;554,23; +2020-12-04;9917,79;9532,34;9725,45;9721,33;558,65; +2020-12-05;9916,31;9525,09;9721,33;9727,55;554,65; +2020-12-06;9912,85;9540,07;9727,55;9715,39;545,74; +2020-12-07;9959,49;9528,03;9715,39;9755,90;552,40; +2020-12-08;9952,65;9547,89;9755,90;9759,57;556,22; +2020-12-09;9965,22;9560,37;9759,57;9750,16;563,85; +2020-12-10;9959,16;9567,02;9750,16;9769,23;567,62; +2020-12-11;9966,51;9578,76;9769,23;9767,27;576,28; +2020-12-12;9964,61;9597,08;9767,27;9784,42;578,17; +2020-12-13;9973,17;9603,19;9784,42;9788,99;575,50; +2020-12-14;9989,26;9601,59;9788,99;9796,19;576,13; +2020-12-15;9983,10;9605,60;9796,19;9793,55;582,81; +2020-12-16;10011,97;9580,65;9793,55;9789,58;579,78; +2020-12-17;9993,11;9570,07;9789,58;9767,86;578,10; +2020-12-18;9960,65;9562,60;9767,86;9762,45;585,89; +2020-12-19;9943,66;9577,75;9762,45;9766,10;569,69; +2020-12-20;9950,02;9554,48;9766,10;9749,11;572,45; +2020-12-21;9947,71;9548,80;9749,11;9746,41;574,02; +2020-12-22;9950,95;9547,58;9746,41;9759,56;581,35; +2020-12-23;9943,39;9563,71;9759,56;9736,99;581,78; +2020-12-24;9924,05;9540,48;9736,99;9760,79;576,47; +2020-12-25;9937,62;9569,23;9760,79;9764,81;577,31; +2020-12-26;9943,64;9565,85;9764,81;9753,39;588,61; +2020-12-27;9963,41;9576,52;9753,39;9781,63;598,77; +2020-12-28;9969,37;9578,89;9781,63;9775,23;603,06; +2020-12-29;9964,29;9601,87;9775,23;9795,14;603,59; +2020-12-30;10029,03;9612,85;9795,14;9833,52;608,92; +2020-12-31;10019,43;9617,19;9833,52;9812,19;614,71; diff --git a/100sim.png b/100sim.png new file mode 100644 index 00000000..d263a1b8 Binary files /dev/null and b/100sim.png differ diff --git a/1sim.png b/1sim.png new file mode 100644 index 00000000..0674ccbd Binary files /dev/null and b/1sim.png differ diff --git a/CandlestickChart.java b/CandlestickChart.java new file mode 100644 index 00000000..8a5a01ff --- /dev/null +++ b/CandlestickChart.java @@ -0,0 +1,46 @@ +import java.util.ArrayList; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartPanel; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.data.xy.DefaultHighLowDataset; +import org.jfree.ui.ApplicationFrame; +import org.jfree.ui.RefineryUtilities; + +public class CandlestickChart extends ApplicationFrame +{ + private static final long serialVersionUID = 1L; + ArrayList dane; + String title; + + public CandlestickChart(String title, ArrayList data) + { + super(title); + this.title = title; + this.dane = data; + DatasetCreator creator = new DatasetCreator(dane); + final DefaultHighLowDataset dataset = creator.createDataset(); + final JFreeChart chart = createChart(dataset); + final ChartPanel chartPanel = new ChartPanel(chart); + + chart.getXYPlot().setOrientation(PlotOrientation.VERTICAL); + //chart.getXYPlot().getRangeAxis().setRange(3000,14000); + chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); + setContentPane(chartPanel); + + } + + private JFreeChart createChart(DefaultHighLowDataset dataset) + { + final JFreeChart chart = ChartFactory.createCandlestickChart("Wykres BTC/USD", "Data", "Cena [USD]", dataset, true); + return chart; + } + + public void showChart() + { + final CandlestickChart chart = new CandlestickChart(title, dane); + chart.pack(); + RefineryUtilities.centerFrameOnScreen(chart); + chart.setVisible(true); + } +} \ No newline at end of file diff --git a/DatasetCreator.java b/DatasetCreator.java new file mode 100644 index 00000000..27c89fbc --- /dev/null +++ b/DatasetCreator.java @@ -0,0 +1,39 @@ +import java.util.ArrayList; +import java.util.Date; +import org.jfree.data.xy.DefaultHighLowDataset; + +public class DatasetCreator +{ + Date [] date; + double[] high; + double[] low; + double[] open; + double[] close; + double[] volume; + + public DatasetCreator(ArrayList dane) + { + int size = dane.size(); + date = new Date[size]; + high = new double[size]; + low = new double[size]; + open = new double[size]; + close = new double[size]; + volume = new double[size]; + + for(int i=0; i avgFromSim(int simCounter, String filename) throws Exception + { + ArrayList history = new ArrayList(), averagePred = new ArrayList(); + Simulator sim = new Simulator("cexio_btcusd_daily.csv", from, to); + history.addAll(sim.history); + sim.makePrediction(sim_target); + + averagePred.addAll(sim.prediction); + + for(int i=1; i plotData = new ArrayList<>(); + plotData.addAll(sim.history); + plotData.addAll(sim.prediction); + + CandlestickChart wykres = new CandlestickChart("BTC/USD", plotData); + wykres.showChart(); + } + + public static void main(String[] args) throws Exception + { +// ArrayList avg = avgFromSim(100,"100btdusd_"+from+"_to_"+to+"_predicted_to_"+sim_target+".csv"); +// CandlestickChart wykres = new CandlestickChart("BTC/USD", avg); +// wykres.showChart(); + + singleSim(); + } +} diff --git a/README.md b/README.md deleted file mode 100644 index 6661a2ed..00000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# MSiD -System Analysis and Decision Support Methods diff --git a/Record.java b/Record.java new file mode 100644 index 00000000..a535408c --- /dev/null +++ b/Record.java @@ -0,0 +1,32 @@ +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.Date; + +public class Record +{ + Date data; + double high, low, open, close, volume; + + public Record(String date, double high, double low, double open, double close, double volume) + { + this.data = Date.from((LocalDate.parse(date).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())); + this.high = high; + this.low = low; + this.open = open; + this.close = close; + this.volume = volume; + } + + @Override + public String toString() { + return String.format("\nData: %-30s\nMax:\t\t%10.2f\nMin:\t\t%10.2f\nOtwarcie:\t%10.2f\nZamkniecie:\t%10.2f\nWolumen:\t%10.2f", data, high, low, open, close, volume); + } + + public String toSeparatedFile() + { + return String.format("%s;%.2f;%.2f;%.2f;%.2f;%.2f;", + data.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().toString(), + high, low, open, close, volume); + } + +} diff --git a/Simulator.java b/Simulator.java new file mode 100644 index 00000000..bea99fbd --- /dev/null +++ b/Simulator.java @@ -0,0 +1,222 @@ +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileReader; +import java.io.FileWriter; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Random; + +public class Simulator +{ + ArrayList history; + ArrayList prediction; + double highChangeVal=0; + double lowChangeVal=0; + double closeGrowProb=0, closeChangeVal=0; + double volGrowProb=0, volChangeVal=0; + + double average=0, median, stdDeviation=0; + + public Simulator(String sourceFile, String fromDate, String toDate) throws Exception + { + LocalDate from=LocalDate.parse(fromDate), to=LocalDate.parse(toDate); + if(from.isAfter(to)) throw new IllegalArgumentException("Zly zakres dat!"); + if(from.isBefore(LocalDate.parse("2015-02-08")) || from.isAfter(LocalDate.parse("2020-06-06")) || to.isAfter(LocalDate.parse("2020-06-06"))) throw new IllegalArgumentException("Brak danych!"); + + history = new ArrayList<>(); + prediction = new ArrayList<>(); + + BufferedReader reader = new BufferedReader(new FileReader(sourceFile)); + String line=""; String [] input; + + while((line=reader.readLine())!=null) + { + input = line.split(";"); + + if(!LocalDate.parse(input[0]).isAfter(to)) + { + if(LocalDate.parse(input[0]).isBefore(from)) break; + + history.add(new Record(input[0], Double.parseDouble(input[1]),Double.parseDouble(input[2]), + Double.parseDouble(input[3]), Double.parseDouble(input[4]), Double.parseDouble(input[5]))); + } + } + + reader.close(); + getParameters(); + } + + public void getParameters() + { + int historySize = history.size(); + + for(int i=0; i history.get(i+1).close) closeGrowProb++; + if(history.get(i).volume > history.get(i+1).volume) volGrowProb++; + + highChangeVal += (history.get(i).high - Math.max(history.get(i).open, history.get(i).close)); + lowChangeVal += (Math.min(history.get(i).open, history.get(i).close) - history.get(i).low); + closeChangeVal += (Math.abs(history.get(i).close - history.get(i+1).close)); + volChangeVal += (Math.abs(history.get(i).volume - history.get(i+1).volume)); + } + highChangeVal += Math.abs(history.get(historySize-1).high - history.get(historySize-1).open); + lowChangeVal += Math.abs(history.get(historySize-1).low - history.get(historySize-1).open); + + closeGrowProb /= (historySize-1); + closeChangeVal /= (historySize-1); + + volGrowProb /= (historySize-1); + volChangeVal /= (historySize-1); + + highChangeVal /= historySize; + lowChangeVal /= historySize; + } + + public String calcStats() + { + average=0; median=0; stdDeviation=0; + + int predicted = prediction.size(); + double [] closePrices = new double[predicted]; + + for(int i=0; i makePrediction(String date) throws Exception + { + LocalDate lastLearnt = history.get(0).data.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + if(LocalDate.parse(date).isAfter(lastLearnt)) + { + prediction = new ArrayList(); + prediction.add(predict(history.get(0))); + int daysToPredict = (int)ChronoUnit.DAYS.between(lastLearnt, LocalDate.parse(date)); + + for(int i=1; i