Dante2333

Untitled

Oct 16th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. Imagine a variable history exist that contains COST/PROCEEDS
  2. These Cost/proceeds will be ccalled C_1, C_2, ..., C_n
  3.  
  4. Imagine we are using ARK coin
  5.  
  6. For elements in history:
  7. Search for last Cost/Proceeds which we will denote C1
  8. if C1 is positive:
  9. Store value of index for "last element"
  10. Search for next C_n that is a sell
  11. if found
  12. index-1 is the beginning of our interval
  13. if C1 is negative:
  14. Last value index is last eleemnt of the interval
  15. Find last sell, take index-1 as beginning of interval
  16.  
  17.  
  18. return sum of C_1 to C_n
Advertisement
Add Comment
Please, Sign In to add comment