Search in sources :

Example 26 with Bar

use of org.ta4j.core.Bar in project ta4j by ta4j.

the class PivotPointIndicatorTest method initDataForYearlyTimeFrame.

@Before
public void initDataForYearlyTimeFrame() {
    String rawData_1_week = "2012-05-14,42.049999,45.000000,38.000000,38.230000,38.230000,573576400\n" + "2012-05-21,36.529999,36.660000,30.940001,31.910000,31.910000,430966300\n" + "2012-05-28,31.480000,31.690001,26.830000,27.719999,27.719999,288826000\n" + "2012-06-04,27.200001,27.760000,25.520000,27.100000,27.100000,203386400\n" + "2012-06-11,27.180000,30.100000,26.840000,30.010000,30.010000,121558000\n" + "2012-06-18,29.959999,33.450001,29.410000,33.049999,33.049999,186090800\n" + "2012-06-25,32.860001,33.439999,30.760000,31.100000,31.100000,115019800\n" + "2012-07-02,31.250000,31.900000,30.549999,31.730000,31.730000,43863300\n" + "2012-07-09,32.099998,32.880001,30.549999,30.719999,30.719999,64494000\n" + "2012-07-16,30.500000,30.500000,27.150000,28.760000,28.760000,97506700\n" + "2012-07-23,28.120001,29.490000,22.280001,23.709999,23.709999,228860400\n" + "2012-07-30,24.000000,24.040001,19.820000,21.090000,21.090000,267091200\n" + "2012-08-06,21.389999,22.450001,20.219999,21.809999,21.809999,135504600\n" + "2012-08-13,22.150000,22.450001,19.000000,19.049999,19.049999,399001700\n" + "2012-08-20,19.049999,20.129999,18.750000,19.410000,19.410000,284155300\n" + "2012-08-27,19.490000,19.530001,18.030001,18.059999,18.059999,151657400\n" + "2012-09-03,18.080000,19.420000,17.549999,18.980000,18.980000,189842400\n" + "2012-09-10,19.059999,22.080000,18.549999,22.000000,22.000000,334751400\n" + "2012-09-17,22.670000,23.370001,21.370001,22.860001,22.860001,274677900\n" + "2012-09-24,21.780001,21.980000,19.799999,21.660000,21.660000,259372000\n" + "2012-10-01,22.080000,22.590000,20.879999,20.910000,20.910000,200025600\n" + "2012-10-08,20.400000,20.750000,19.450001,19.520000,19.520000,139347000\n" + "2012-10-15,19.680000,20.480000,18.799999,19.000000,19.000000,173091300\n" + "2012-10-22,19.200001,24.250000,19.049999,21.940001,21.940001,489096200\n" + "2012-10-29,20.820000,21.690001,20.730000,21.180000,21.180000,175436500\n" + "2012-11-05,21.100000,21.480000,19.129999,19.209999,19.209999,170816300\n" + "2012-11-12,19.150000,23.930000,18.870001,23.559999,23.559999,554915200\n" + "2012-11-19,23.959999,24.680000,22.700001,24.000000,24.000000,251059900\n" + "2012-11-26,24.940001,28.000000,24.809999,28.000000,28.000000,474640500\n" + "2012-12-03,28.000000,28.879999,26.680000,27.490000,27.490000,353125000\n" + "2012-12-10,27.170000,28.750000,26.760000,26.809999,26.809999,347095000\n" + "2012-12-17,26.770000,28.219999,26.120001,26.260000,26.260000,269775700\n" + "2012-12-24,26.500000,27.180000,25.150000,25.910000,25.910000,161462000\n" + "2012-12-31,26.200001,28.930000,26.110001,28.760000,28.760000,266076900\n" + "2013-01-07,28.690001,31.959999,28.650000,31.719999,31.719999,419355200\n" + "2013-01-14,32.080002,32.209999,29.270000,29.660000,29.660000,437356300\n" + "2013-01-21,29.750000,31.930000,29.740000,31.540001,31.540001,202351800\n" + "2013-01-28,31.879999,32.509998,28.740000,29.730000,29.730000,496942700\n" + "2013-02-04,29.059999,29.290001,28.010000,28.549999,28.549999,250935200\n" + "2013-02-11,28.610001,28.750000,27.100000,28.320000,28.320000,249749600\n" + "2013-02-18,28.230000,29.080000,26.820000,27.129999,27.129999,177487100\n" + "2013-02-25,27.160000,28.120001,26.340000,27.780001,27.780001,247676000\n" + "2013-03-04,27.760000,28.680000,27.209999,27.959999,27.959999,225294600\n" + "2013-03-11,28.010000,28.639999,26.559999,26.650000,26.650000,162075000\n" + "2013-03-18,26.370001,26.900000,25.559999,25.730000,25.730000,138706800\n" + "2013-03-25,25.750000,26.280001,24.719999,25.580000,25.580000,147039300\n" + "2013-04-01,25.629999,27.799999,25.280001,27.389999,27.389999,252181200\n" + "2013-04-08,27.190001,28.100000,26.420000,27.400000,27.400000,156582400\n" + "2013-04-15,27.160000,27.480000,25.150000,25.730000,25.730000,143521800\n" + "2013-04-22,25.809999,27.620001,25.700001,26.850000,26.850000,120777000\n" + "2013-04-29,27.160000,29.070000,26.860001,28.309999,28.309999,292777800\n" + "2013-05-06,28.330000,28.459999,26.570000,26.680000,26.680000,184157700\n" + "2013-05-13,26.600000,27.330000,25.900000,26.250000,26.250000,149260700\n" + "2013-05-20,26.180000,26.190001,24.080000,24.309999,24.309999,210369700\n" + "2013-05-27,24.540001,24.950001,23.260000,24.350000,24.350000,210975700\n" + "2013-06-03,24.270000,24.320000,22.670000,23.290001,23.290001,194274200\n" + "2013-06-10,24.059999,24.600000,23.260000,23.629999,23.629999,176591100\n" + "2013-06-17,23.910000,25.190001,23.650000,24.530001,24.530001,190763700\n" + "2013-06-24,23.950001,24.980000,23.379999,24.879999,24.879999,226702500\n" + "2013-07-01,24.969999,25.059999,24.150000,24.370001,24.370001,69610200\n" + "2013-07-08,24.469999,26.000000,24.420000,25.910000,25.910000,127489600\n" + "2013-07-15,25.930000,26.780001,25.600000,25.879999,25.879999,147916700\n" + "2013-07-22,25.990000,34.880001,25.719999,34.009998,34.009998,639870300\n" + "2013-07-29,34.070000,38.490002,34.009998,38.049999,38.049999,632255300\n" + "2013-08-05,38.430000,39.320000,37.700001,38.500000,38.500000,297633700\n" + "2013-08-12,38.200001,38.500000,36.020000,37.080002,37.080002,247326000\n" + "2013-08-19,37.430000,40.630001,37.139999,40.549999,40.549999,270095200\n" + "2013-08-26,40.900002,42.259998,39.419998,41.290001,41.290001,350814200\n" + "2013-09-02,41.840000,44.610001,41.439999,43.950001,43.950001,258927900\n" + "2013-09-09,44.360001,45.619999,43.110001,44.310001,44.310001,323500900\n" + "2013-09-16,44.849998,47.599998,42.430000,47.490002,47.490002,421156600\n" + "2013-09-23,47.279999,51.279999,46.290001,51.240002,51.240002,479403400\n" + "2013-09-30,50.139999,51.599998,49.060001,51.040001,51.040001,417535000\n" + "2013-10-07,50.730000,51.290001,45.259998,49.110001,49.110001,498784000\n" + "2013-10-14,48.310001,54.830002,47.910000,54.220001,54.220001,374408000\n" + "2013-10-21,54.680000,54.810001,51.130001,51.950001,51.950001,290506000\n" + "2013-10-28,51.540001,52.090000,46.500000,49.750000,49.750000,646530000\n" + "2013-11-04,49.369999,50.450001,47.250000,47.529999,47.529999,392954000\n" + "2013-11-11,47.040001,49.570000,45.730000,49.009998,49.009998,345921000\n" + "2013-11-18,48.470001,48.840000,45.720001,46.230000,46.230000,290876000\n" + "2013-11-25,46.360001,47.209999,43.549999,47.009998,47.009998,232527900\n" + "2013-12-02,46.900002,49.389999,46.259998,47.939999,47.939999,230543000\n" + "2013-12-09,48.090000,53.500000,47.740002,53.320000,53.320000,345675000\n" + "2013-12-16,53.250000,55.889999,52.910000,55.119999,55.119999,569450200\n" + "2013-12-23,55.500000,58.580002,55.250000,55.439999,55.439999,260481800\n" + "2013-12-30,54.930000,55.650002,53.430000,54.560001,54.560001,192824900\n" + "2014-01-06,54.419998,58.959999,54.049999,57.939999,57.939999,337445200\n" + "2014-01-13,57.910000,58.570000,55.380001,56.299999,56.299999,209568900\n" + "2014-01-20,56.599998,59.310001,54.400002,54.450001,54.450001,213174600\n" + "2014-01-27,54.730000,63.369999,51.849998,62.570000,62.570000,453084400\n" + "2014-02-03,63.029999,64.570000,60.700001,64.320000,64.320000,275328000\n" + "2014-02-10,64.300003,67.580002,63.349998,67.089996,67.089996,235230400\n" + "2014-02-17,66.940002,70.110001,65.730003,68.589996,68.589996,307758300\n" + "2014-02-24,68.739998,71.440002,67.379997,68.459999,68.459999,292457400\n" + "2014-03-03,66.959999,71.970001,66.510002,69.800003,69.800003,258358800\n" + "2014-03-10,70.769997,72.589996,67.459999,67.720001,67.720001,270938400\n" + "2014-03-17,68.180000,69.599998,66.180000,67.239998,67.239998,241443900\n" + "2014-03-24,67.190002,67.360001,57.980000,60.009998,60.009998,431687900\n" + "2014-03-31,60.779999,63.910000,56.320000,56.750000,56.750000,387652400\n" + "2014-04-07,55.900002,63.180000,55.439999,58.529999,58.529999,493979000\n" + "2014-04-14,60.090000,60.580002,55.880001,58.939999,58.939999,347762000\n" + "2014-04-21,59.459999,63.650002,57.570000,57.709999,57.709999,448174700\n" + "2014-04-28,58.049999,62.279999,54.660000,60.459999,60.459999,396026000\n" + "2014-05-05,59.669998,61.349998,56.259998,57.240002,57.240002,294380000\n" + "2014-05-12,57.980000,60.889999,57.310001,58.020000,58.020000,249276000\n" + "2014-05-19,57.889999,61.480000,57.570000,61.349998,61.349998,248451000\n" + "2014-05-26,61.619999,64.300003,61.570000,63.299999,63.299999,191430500\n" + "2014-06-02,63.230000,64.360001,62.049999,62.500000,62.500000,194521000\n" + "2014-06-09,62.400002,66.470001,61.790001,64.500000,64.500000,236346000\n" + "2014-06-16,64.160004,65.750000,63.349998,64.500000,64.500000,175042000\n" + "2014-06-23,64.320000,68.000000,64.220001,67.599998,67.599998,230378000\n" + "2014-06-30,67.459999,68.440002,65.760002,66.290001,66.290001,127444000\n" + "2014-07-07,66.300003,66.589996,62.209999,66.339996,66.339996,232737000\n" + "2014-07-14,67.129997,68.459999,66.040001,68.419998,68.419998,192935800\n" + "2014-07-21,68.809998,76.739998,68.500000,75.190002,75.190002,338457000\n" + "2014-07-28,75.169998,75.500000,71.550003,72.360001,72.360001,207429000\n" + "2014-08-04,72.360001,74.000000,71.790001,73.059998,73.059998,162092000\n" + "2014-08-11,73.459999,74.650002,72.220001,73.629997,73.629997,142329600\n" + "2014-08-18,74.000000,75.580002,73.570000,74.570000,74.570000,114569000\n" + "2014-08-25,74.940002,75.989998,73.730003,74.820000,74.820000,128238000\n" + "2014-09-01,75.010002,77.480003,74.820000,77.260002,77.260002,123520000\n" + "2014-09-08,77.260002,78.360001,76.199997,77.480003,77.480003,145869800\n" + "2014-09-15,77.150002,78.300003,73.070000,77.910004,77.910004,215816000\n" + "2014-09-22,77.000000,78.940002,75.949997,78.790001,78.790001,165860000\n" + "2014-09-29,78.120003,79.709999,75.639999,77.440002,77.440002,184848000\n" + "2014-10-06,77.190002,77.949997,72.760002,72.910004,72.910004,168655000\n" + "2014-10-13,73.230003,76.000000,70.320000,75.949997,75.949997,285636000\n" + "2014-10-20,75.599998,80.820000,75.379997,80.669998,80.669998,176119000\n" + "2014-10-27,80.739998,81.160004,72.900002,74.989998,74.989998,338315000\n" + "2014-11-03,75.470001,76.800003,73.650002,75.599998,75.599998,158123000\n" + "2014-11-10,75.360001,75.480003,73.540001,74.879997,74.879997,112752800\n" + "2014-11-17,74.879997,75.660004,72.510002,73.750000,73.750000,117048200\n" + "2014-11-24,73.540001,78.269997,73.349998,77.699997,77.699997,103041300\n" + "2014-12-01,77.260002,77.309998,74.400002,76.360001,76.360001,103922900\n" + "2014-12-08,76.180000,78.879997,74.779999,77.830002,77.830002,144856700\n" + "2014-12-15,78.459999,80.000000,74.589996,79.879997,79.879997,167712100\n" + "2014-12-22,80.080002,82.169998,80.000000,80.779999,80.779999,69594500\n" + "2014-12-29,80.489998,80.959999,77.699997,78.449997,78.449997,66723400\n" + "2015-01-05,77.980003,79.250000,75.360001,77.739998,77.739998,120996500\n" + "2015-01-12,77.839996,78.080002,73.540001,75.180000,75.180000,126213900\n" + "2015-01-19,75.720001,78.190002,74.820000,77.830002,77.830002,83690100\n" + "2015-01-26,77.980003,78.470001,74.209999,75.910004,75.910004,196620200\n" + "2015-02-02,76.110001,76.349998,73.750000,74.470001,74.470001,125159500\n" + "2015-02-09,74.050003,76.870003,73.449997,75.739998,75.739998,88739900\n" + "2015-02-16,75.300003,80.339996,75.080002,79.900002,79.900002,130371900\n" + "2015-02-23,79.959999,81.370003,78.099998,78.970001,78.970001,130449000\n" + "2015-03-02,79.000000,81.989998,78.519997,80.010002,80.010002,120626300\n" + "2015-03-09,79.680000,79.910004,77.260002,78.050003,78.050003,96623700\n" + "2015-03-16,77.959999,84.599998,77.360001,83.800003,83.800003,164584900\n" + "2015-03-23,83.919998,86.070000,82.139999,83.300003,83.300003,148126900\n" + "2015-03-30,83.809998,84.339996,80.870003,81.559998,81.559998,85910200\n" + "2015-04-06,80.800003,83.419998,80.800003,82.040001,82.040001,83953600\n" + "2015-04-13,81.930000,83.940002,80.370003,80.779999,80.779999,106702600\n" + "2015-04-20,81.540001,85.589996,81.239998,81.529999,81.529999,204786400\n" + "2015-04-27,81.870003,82.930000,78.110001,78.989998,78.989998,128787000\n" + "2015-05-04,79.330002,79.690002,77.050003,78.510002,78.510002,105359300\n" + "2015-05-11,78.480003,81.849998,76.790001,80.419998,80.419998,138179600\n" + "2015-05-18,80.330002,81.690002,79.459999,80.540001,80.540001,95060100\n" + "2015-05-25,80.430000,81.070000,78.879997,79.190002,79.190002,58548100\n" + "2015-06-01,79.300003,82.949997,78.660004,82.139999,82.139999,105794700\n" + "2015-06-08,81.820000,82.900002,79.320000,81.529999,81.529999,84975000\n" + "2015-06-15,80.550003,83.190002,80.070000,82.510002,82.510002,100984900\n" + "2015-06-22,83.410004,89.400002,83.309998,88.010002,88.010002,186937800\n" + "2015-06-29,86.610001,87.949997,85.570000,87.290001,87.290001,101359900\n" + "2015-07-06,86.489998,88.220001,85.230003,87.949997,87.949997,128648400\n" + "2015-07-13,88.660004,95.389999,88.419998,94.970001,94.970001,163296800\n" + "2015-07-20,95.849998,99.239998,94.809998,96.949997,96.949997,185477000\n" + "2015-07-27,96.580002,97.279999,91.800003,94.010002,94.010002,271190000\n" + "2015-08-03,93.529999,98.739998,92.800003,94.300003,94.300003,144762700\n" + "2015-08-10,95.680000,95.900002,91.190002,94.419998,94.419998,103377900\n" + "2015-08-17,94.419998,96.099998,85.610001,86.059998,86.059998,171220500\n" + "2015-08-24,77.029999,91.480003,72.000000,91.010002,91.010002,256503500\n" + "2015-08-31,90.599998,91.050003,86.500000,88.260002,88.260002,149671500\n" + "2015-09-07,89.690002,92.080002,88.830002,92.050003,92.050003,107073900\n" + "2015-09-14,92.309998,95.510002,91.599998,94.400002,94.400002,144827900\n" + "2015-09-21,94.620003,96.489998,91.919998,92.769997,92.769997,145447900\n" + "2015-09-28,92.080002,92.290001,85.720001,92.070000,92.070000,186677400\n" + "2015-10-05,92.940002,94.269997,90.470001,93.239998,93.239998,120898000\n" + "2015-10-12,93.320000,97.589996,92.669998,97.540001,97.540001,110153700\n" + "2015-10-19,97.180000,102.849998,96.470001,102.190002,102.190002,145550000\n" + "2015-10-26,102.199997,105.120003,101.550003,101.970001,101.970001,127425200\n" + "2015-11-02,101.720001,110.650002,101.180000,107.099998,107.099998,182169800\n" + "2015-11-09,107.000000,109.870003,103.830002,103.949997,103.949997,127675400\n" + "2015-11-16,103.320000,107.879997,100.470001,107.320000,107.320000,147603100\n" + "2015-11-23,107.190002,107.470001,104.389999,105.449997,105.449997,64538400\n" + "2015-11-30,105.839996,107.919998,103.349998,106.180000,106.180000,112055400\n" + "2015-12-07,106.480003,106.910004,101.910004,102.120003,102.120003,103236200\n" + "2015-12-14,102.290001,107.750000,101.459999,104.040001,104.040001,126762800\n" + "2015-12-21,104.910004,106.110001,103.599998,105.019997,105.019997,56671200\n" + "2015-12-28,105.019997,107.739998,104.529999,104.660004,104.660004,61717200\n" + "2016-01-04,101.949997,103.769997,97.029999,97.330002,97.330002,166842000\n" + "2016-01-11,97.910004,100.580002,92.449997,94.970001,94.970001,186470500\n" + "2016-01-18,96.529999,98.070000,89.370003,97.940002,97.940002,151064000\n" + "2016-01-25,98.720001,112.839996,94.230003,112.209999,112.209999,288033600\n" + "2016-02-01,112.269997,117.589996,103.180000,104.070000,104.070000,278373800\n" + "2016-02-08,100.410004,105.110001,96.820000,102.010002,102.010002,258836600\n" + "2016-02-15,103.800003,106.000000,100.239998,104.570000,104.570000,151758600\n" + "2016-02-22,105.489998,109.449997,102.739998,107.919998,107.919998,151923800\n" + "2016-02-29,107.599998,110.550003,106.750000,108.389999,108.389999,131538900\n" + "2016-03-07,108.070000,109.419998,104.400002,109.410004,109.410004,123025000\n" + "2016-03-14,109.279999,112.690002,108.769997,111.449997,111.449997,120110800\n" + "2016-03-21,111.660004,113.190002,111.029999,113.050003,113.050003,73850200\n" + "2016-03-28,113.320000,116.989998,112.949997,116.059998,116.059998,130320800\n" + "2016-04-04,114.070000,114.889999,109.900002,110.629997,110.629997,161185000\n" + "2016-04-11,110.699997,112.650002,106.519997,109.639999,109.639999,203519300\n" + "2016-04-18,109.739998,114.040001,109.010002,110.559998,110.559998,131664500\n" + "2016-04-25,109.870003,120.790001,106.309998,117.580002,117.580002,220003200\n" + "2016-05-02,117.830002,119.639999,116.570000,119.489998,119.489998,124045200\n" + "2016-05-09,119.540001,121.080002,118.900002,119.809998,119.809998,106140000\n" + "2016-05-16,119.379997,119.610001,115.879997,117.349998,117.349998,113707600\n" + "2016-05-23,117.419998,119.849998,115.940002,119.379997,119.379997,92255900\n" + "2016-05-30,119.459999,120.099998,117.820000,118.470001,118.470001,65902100\n" + "2016-06-06,118.620003,119.430000,116.260002,116.620003,116.620003,76723300\n" + "2016-06-13,115.000000,115.480003,112.559998,113.019997,113.019997,113036700\n" + "2016-06-20,113.769997,115.209999,111.000000,112.080002,112.080002,111618000\n" + "2016-06-27,111.570000,115.180000,108.230003,114.190002,114.190002,122085200\n" + "2016-07-04,113.940002,117.500000,112.970001,117.239998,117.239998,73287800\n" + "2016-07-11,117.709999,118.720001,116.580002,116.860001,116.860001,80362700\n" + "2016-07-18,117.320000,122.199997,116.889999,121.000000,121.000000,98680300\n" + "2016-07-25,121.389999,128.330002,117.779999,123.940002,123.940002,196787900\n" + "2016-08-01,123.849998,125.839996,122.070000,125.150002,125.150002,108722600\n" + "2016-08-08,125.250000,126.089996,124.180000,124.879997,124.879997,69341500\n" + "2016-08-15,124.910004,124.919998,122.779999,123.559998,123.559998,71400800\n" + "2016-08-22,123.330002,125.190002,123.089996,124.959999,124.959999,68175200\n" + "2016-08-29,124.349998,126.860001,124.349998,126.510002,126.510002,73475400\n" + "2016-09-05,126.669998,131.979996,126.470001,127.099998,127.099998,96923100\n" + "2016-09-12,125.959999,129.179993,125.750000,129.070007,129.070007,94156500\n" + "2016-09-19,129.910004,130.729996,127.300003,127.959999,127.959999,83936500\n" + "2016-09-26,127.370003,129.470001,126.800003,128.270004,128.270004,75684700\n" + "2016-10-03,128.380005,129.279999,127.550003,128.990005,128.990005,64338300\n" + "2016-10-10,129.679993,130.699997,126.750000,127.879997,127.879997,74196900\n" + "2016-10-17,128.199997,132.130005,127.320000,132.070007,132.070007,73817500\n" + "2016-10-24,132.720001,133.500000,129.270004,131.289993,131.289993,85178600\n" + "2016-10-31,132.009995,132.119995,119.250000,120.750000,120.750000,171699500\n" + "2016-11-07,122.830002,124.610001,115.269997,119.019997,119.019997,174979500\n" + "2016-11-14,119.129997,119.129997,113.550003,117.019997,117.019997,159751300\n" + "2016-11-21,118.199997,122.980003,117.800003,120.379997,120.379997,85755600\n" + "2016-11-28,120.120003,122.099998,114.000000,115.400002,115.400002,135528600\n" + "2016-12-05,115.949997,119.940002,115.070000,119.680000,119.680000,101153900\n" + "2016-12-12,119.220001,122.500000,117.610001,119.870003,119.870003,118800800\n" + "2016-12-19,119.849998,120.360001,116.300003,117.269997,117.269997,67506000\n" + "2016-12-26,116.959999,118.680000,114.769997,115.050003,115.050003,52744400\n" + "2017-01-02,116.029999,123.879997,115.510002,123.410004,123.410004,88332300\n" + "2017-01-09,123.550003,129.270004,123.040001,128.339996,128.339996,101988300\n" + "2017-01-16,128.039993,128.479996,126.779999,127.040001,127.040001,59628200\n" + "2017-01-23,127.309998,133.139999,126.949997,132.179993,132.179993,90001600\n" + "2017-01-30,131.580002,135.490005,129.520004,130.979996,130.979996,168057700\n" + "2017-02-06,130.979996,134.940002,130.300003,134.190002,134.190002,85549000\n" + "2017-02-13,134.699997,134.699997,132.550003,133.529999,133.529999,66200400\n" + "2017-02-20,133.500000,136.789993,132.899994,135.440002,135.440002,73120200\n" + "2017-02-27,135.259995,137.820007,134.750000,137.169998,137.169998,70100900\n" + "2017-03-06,136.880005,139.490005,136.509995,138.789993,138.789993,68309200\n" + "2017-03-13,138.710007,140.339996,138.490005,139.839996,139.839996,77450000\n" + "2017-03-20,139.710007,142.309998,137.600006,140.339996,140.339996,88737200\n" + "2017-03-27,139.050003,142.949997,138.770004,142.050003,142.050003,67889800\n" + "2017-04-03,141.929993,143.440002,140.240005,140.779999,140.779999,70592400\n" + "2017-04-10,141.000000,141.429993,138.809998,139.389999,139.389999,48255600\n" + "2017-04-17,139.759995,144.250000,139.750000,143.679993,143.679993,70241300\n" + "2017-04-24,144.960007,151.529999,144.339996,150.250000,150.250000,86497000\n" + "2017-05-01,151.740005,153.600006,148.720001,150.240005,150.240005,130245200\n" + "2017-05-08,150.710007,152.589996,148.860001,150.330002,150.330002,66802200\n" + "2017-05-15,150.169998,151.479996,144.419998,148.059998,148.059998,97135100\n" + "2017-05-22,148.080002,152.589996,147.250000,152.130005,152.130005,78129100\n" + "2017-05-29,151.970001,153.630005,150.300003,153.610001,153.610001,62634900\n" + "2017-06-05,153.639999,155.589996,146.610001,149.600006,149.600006,91421300\n" + "2017-06-12,148.169998,152.399994,144.559998,150.639999,150.639999,116339000\n" + "2017-06-19,151.710007,155.199997,151.710007,155.070007,155.070007,79842700\n" + "2017-06-26,156.250000,156.500000,148.919998,150.979996,150.979996,92968600\n" + "2017-07-03,151.720001,152.149994,147.800003,151.440002,151.440002,56679800\n" + "2017-07-10,151.690002,160.320007,151.509995,159.970001,159.970001,80086200\n" + "2017-07-17,160.250000,165.699997,158.809998,164.429993,164.429993,96122400\n" + "2017-07-24,164.639999,175.490005,163.860001,172.449997,172.449997,161455400\n" + "2017-07-31,172.000000,172.720001,166.910004,169.619995,169.619995,78869200\n" + "2017-08-07,169.949997,173.050003,166.850006,168.080002,168.080002,72620200\n" + "2017-08-14,170.089996,171.500000,166.210007,167.410004,167.410004,69772900\n" + "2017-08-21,167.160004,169.869995,165.820007,166.320007,166.320007,59799900\n" + "2017-08-28,166.910004,172.919998,165.000000,172.020004,172.020004,59717100\n" + "2017-09-04,171.270004,173.490005,169.550003,170.949997,170.949997,56165200\n" + "2017-09-11,172.399994,174.000000,170.259995,171.639999,171.639999,63953800\n" + "2017-09-18,171.990005,173.050003,169.220001,170.539993,170.539993,61645200\n" + "2017-09-25,169.240005,171.660004,161.559998,170.869995,170.869995,111376500\n" + "2017-10-02,171.389999,172.369995,168.289993,172.229996,172.229996,60993900";
    String[] dataLine = rawData_1_week.split("\n");
    List<Bar> bars = new ArrayList<>();
    for (int i = 0; i < dataLine.length; i++) {
        String[] barData = dataLine[i].split(",");
        ZonedDateTime date = LocalDate.parse(barData[0], DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay(ZoneId.systemDefault());
        double open = Double.parseDouble(barData[1]);
        double high = Double.parseDouble(barData[2]);
        double low = Double.parseDouble(barData[3]);
        double close = Double.parseDouble(barData[4]);
        double volume = Double.parseDouble(barData[6]);
        bars.add(new BaseBar(date, open, high, low, close, volume));
    }
    series_1_weeks = new BaseTimeSeries("FB_daily", bars);
}
Also used : Bar(org.ta4j.core.Bar) BaseBar(org.ta4j.core.BaseBar) ZonedDateTime(java.time.ZonedDateTime) BaseBar(org.ta4j.core.BaseBar) BaseTimeSeries(org.ta4j.core.BaseTimeSeries) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Example 27 with Bar

use of org.ta4j.core.Bar in project ta4j by ta4j.

the class CandlestickChart method createAdditionalDataset.

/**
 * Builds an additional JFreeChart dataset from a ta4j time series.
 * @param series a time series
 * @return an additional dataset
 */
private static TimeSeriesCollection createAdditionalDataset(TimeSeries series) {
    ClosePriceIndicator indicator = new ClosePriceIndicator(series);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    org.jfree.data.time.TimeSeries chartTimeSeries = new org.jfree.data.time.TimeSeries("Btc price");
    for (int i = 0; i < series.getBarCount(); i++) {
        Bar bar = series.getBar(i);
        chartTimeSeries.add(new Second(new Date(bar.getEndTime().toEpochSecond() * 1000)), indicator.getValue(i).toDouble());
    }
    dataset.addSeries(chartTimeSeries);
    return dataset;
}
Also used : Bar(org.ta4j.core.Bar) TimeSeries(org.ta4j.core.TimeSeries) Second(org.jfree.data.time.Second) TimeSeriesCollection(org.jfree.data.time.TimeSeriesCollection) ClosePriceIndicator(org.ta4j.core.indicators.helpers.ClosePriceIndicator) Date(java.util.Date)

Example 28 with Bar

use of org.ta4j.core.Bar in project ta4j by ta4j.

the class CandlestickChart method createOHLCDataset.

/**
 * Builds a JFreeChart OHLC dataset from a ta4j time series.
 * @param series a time series
 * @return an Open-High-Low-Close dataset
 */
private static OHLCDataset createOHLCDataset(TimeSeries series) {
    final int nbBars = series.getBarCount();
    Date[] dates = new Date[nbBars];
    double[] opens = new double[nbBars];
    double[] highs = new double[nbBars];
    double[] lows = new double[nbBars];
    double[] closes = new double[nbBars];
    double[] volumes = new double[nbBars];
    for (int i = 0; i < nbBars; i++) {
        Bar bar = series.getBar(i);
        dates[i] = new Date(bar.getEndTime().toEpochSecond() * 1000);
        opens[i] = bar.getOpenPrice().doubleValue();
        highs[i] = bar.getMaxPrice().doubleValue();
        lows[i] = bar.getMinPrice().doubleValue();
        closes[i] = bar.getClosePrice().doubleValue();
        volumes[i] = bar.getVolume().doubleValue();
    }
    return new DefaultHighLowDataset("btc", dates, highs, lows, opens, closes, volumes);
}
Also used : Bar(org.ta4j.core.Bar) DefaultHighLowDataset(org.jfree.data.xy.DefaultHighLowDataset) Date(java.util.Date)

Example 29 with Bar

use of org.ta4j.core.Bar in project ta4j by ta4j.

the class IndicatorsToChart method buildChartTimeSeries.

/**
 * Builds a JFreeChart time series from a Ta4j time series and an indicator.
 * @param barseries the ta4j time series
 * @param indicator the indicator
 * @param name the name of the chart time series
 * @return the JFreeChart time series
 */
private static org.jfree.data.time.TimeSeries buildChartTimeSeries(TimeSeries barseries, Indicator<Decimal> indicator, String name) {
    org.jfree.data.time.TimeSeries chartTimeSeries = new org.jfree.data.time.TimeSeries(name);
    for (int i = 0; i < barseries.getBarCount(); i++) {
        Bar bar = barseries.getBar(i);
        chartTimeSeries.add(new Day(Date.from(bar.getEndTime().toInstant())), indicator.getValue(i).doubleValue());
    }
    return chartTimeSeries;
}
Also used : Bar(org.ta4j.core.Bar) TimeSeries(org.ta4j.core.TimeSeries) Day(org.jfree.data.time.Day)

Example 30 with Bar

use of org.ta4j.core.Bar in project ta4j by ta4j.

the class CsvBarsLoader method loadAppleIncSeries.

/**
 * @return a time series from Apple Inc. bars.
 */
public static TimeSeries loadAppleIncSeries() {
    InputStream stream = CsvBarsLoader.class.getClassLoader().getResourceAsStream("appleinc_bars_from_20130101_usd.csv");
    List<Bar> bars = new ArrayList<>();
    CSVReader csvReader = new CSVReader(new InputStreamReader(stream, Charset.forName("UTF-8")), ',', '"', 1);
    try {
        String[] line;
        while ((line = csvReader.readNext()) != null) {
            ZonedDateTime date = LocalDate.parse(line[0], DATE_FORMAT).atStartOfDay(ZoneId.systemDefault());
            double open = Double.parseDouble(line[1]);
            double high = Double.parseDouble(line[2]);
            double low = Double.parseDouble(line[3]);
            double close = Double.parseDouble(line[4]);
            double volume = Double.parseDouble(line[5]);
            bars.add(new BaseBar(date, open, high, low, close, volume));
        }
    } catch (IOException ioe) {
        Logger.getLogger(CsvBarsLoader.class.getName()).log(Level.SEVERE, "Unable to load bars from CSV", ioe);
    } catch (NumberFormatException nfe) {
        Logger.getLogger(CsvBarsLoader.class.getName()).log(Level.SEVERE, "Error while parsing value", nfe);
    }
    return new BaseTimeSeries("apple_bars", bars);
}
Also used : InputStreamReader(java.io.InputStreamReader) CSVReader(com.opencsv.CSVReader) InputStream(java.io.InputStream) BaseBar(org.ta4j.core.BaseBar) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Bar(org.ta4j.core.Bar) BaseBar(org.ta4j.core.BaseBar) ZonedDateTime(java.time.ZonedDateTime) BaseTimeSeries(org.ta4j.core.BaseTimeSeries)

Aggregations

Bar (org.ta4j.core.Bar)104 ArrayList (java.util.ArrayList)60 MockBar (org.ta4j.core.mocks.MockBar)48 MockTimeSeries (org.ta4j.core.mocks.MockTimeSeries)42 Before (org.junit.Before)37 Test (org.junit.Test)33 Decimal (org.ta4j.core.Decimal)20 IOException (java.io.IOException)16 BaseTimeSeries (org.ta4j.core.BaseTimeSeries)16 BitfinexCurrencyPair (com.github.jnidzwetzki.bitfinex.v2.entity.BitfinexCurrencyPair)15 Timeframe (com.github.jnidzwetzki.bitfinex.v2.entity.Timeframe)15 ZonedDateTime (java.time.ZonedDateTime)15 CountDownLatch (java.util.concurrent.CountDownLatch)15 BiConsumer (java.util.function.BiConsumer)15 BarMerger (com.github.jnidzwetzki.cryptobot.util.BarMerger)14 ParseException (java.text.ParseException)14 SimpleDateFormat (java.text.SimpleDateFormat)14 Assert (org.junit.Assert)14 BaseBar (org.ta4j.core.BaseBar)12 TimeSeries (org.ta4j.core.TimeSeries)9