title: How to write this iteration?
body: <p>I want estimate the strategy I make:
  buy- where the K_Class is 1
  sell- where the K_Class is 0
  all  prices is refered to Close Column at the time</p>
  
  <p>for example:
  Suppose that I have the amount of money 10000, the first time I buy is 2017/03/13, the first time I sell is 2017/03/17. The second time I buy is 2017/03/20, the second time I sell is on 2017/03/22</p>
  
  <p>My Question: Till the end, how do I calculate the amount of money?</p>
  
  <pre><code> Time        Close        K_Class
      0     2017/03/06  31.72        0
      1     2017/03/08  33.99        0
      2     2017/03/09  32.02        0
      3     2017/03/10  30.66        0
      4     2017/03/13  30.94        1
      5     2017/03/15  32.56        1
      6     2017/03/17  33.31        0
      7     2017/03/20  34.07        1
      8     2017/03/22  34.40        0
      9     2017/03/24  32.98        1
      10    2017/03/27  33.26        0
      11    2017/03/28  31.60        0
      12    2017/03/29  30.36        0
      13    2017/03/30  28.83        0
      14    2017/04/11  27.01        0
      15    2017/04/12  24.31        0
      16    2017/04/14  24.22        0
      17    2017/04/17  21.80        0
      18    2017/04/18  21.20        1
      19    2017/04/19  23.32        1
      20    2017/04/20  24.43        0
      21    2017/04/24  23.85        1
      22    2017/04/26  23.97        1
      23    2017/04/27  24.31        1
      24    2017/04/28  23.50        1
      25    2017/05/02  22.57        1
      26    2017/05/03  22.67        1
      27    2017/05/04  22.11        1
      28    2017/05/05  21.26        1
      29    2017/05/08  19.37        1
      ..           ...    ...      ...
      275   2018/08/01  13.38        0
      276   2018/08/03  12.49        0
      277   2018/08/06  12.50        0
      278   2018/08/07  12.78        0
      279   2018/08/09  12.93        0
      280   2018/08/10  13.15        0
      281   2018/08/13  13.14        1
      282   2018/08/14  13.15        0
      283   2018/08/15  12.80        0
      284   2018/08/17  12.29        0
      285   2018/08/21  12.39        0
      286   2018/08/22  12.15        0
      287   2018/08/23  12.27        0
      288   2018/08/24  12.31        0
      289   2018/08/27  12.47        0
      290   2018/08/29  12.31        0
      291   2018/08/30  12.13        0
      292   2018/08/31  11.69        0
      293   2018/09/03  11.60        1
      294   2018/09/04  11.65        0
      295   2018/09/05  11.45        0
      296   2018/09/07  11.42        0
      297   2018/09/10  10.71        0
      298   2018/09/11  10.76        1
      299   2018/09/12  10.74        0
      300   2018/09/13  10.85        1
      301   2018/09/14  10.79        0
      302   2018/09/18  10.58        1
      303   2018/09/19  10.65        1
      304   2018/09/21  10.73        1
  </code></pre>