Author

Topic: Calculating profit / loss for incomplete data is impossible? (Read 120 times)

newbie
Activity: 5
Merit: 0
When we have a complete history of trading, then to calculate the profit is not a problem.
But suppose, we want to calculate the profit in the time interval from 13:42 to 20:00

+------------------+------+---------+------------+--------+
| date                   | type  | fiat       | coin           | price    |
+------------------+------+---------+------------+--------+
| 2017-12-03 13:42 | buy  | 3610,28 |   0,011587 | 311580 |
| 2017-12-03 13:43 | buy  | 3128,47 |   0,010032 | 311849 |
| 2017-12-03 14:30 | _sell | 1956,82 | 0,00612102 | 319689 |
| 2017-12-03 14:31 | _sell |  236381 |    0,74101  | 318999 |
| 2017-12-03 14:38 | buy  | 2975,82 |   0,009432 | 315502 |
| 2017-12-03 14:57 | buy  | 1050,15 |   0,003292 | 319001 |
| 2017-12-03 14:58 | buy  | 5024,27 |    0,01575 | 319001 |
| 2017-12-03 18:49 | buy  |   16692 |   0,051662 | 323100 |
| 2017-12-03 19:10 | buy  | 32045,8 |   0,099114 | 323323 |
| 2017-12-03 19:31 | _sell | 5102,79 |   0,015701 | 324998 |
| 2017-12-03 19:32 | _sell | 324,998 |      0,001   | 324998 |
| 2017-12-03 19:36 | buy  | 2720,62 |   0,008397 | 323999 |
| 2017-12-03 19:36 | buy  |  119698 |   0,369439 | 323999 |
| 2017-12-03 19:41 | _sell | 4479,86 |  0,0137546 | 325699 |
| 2017-12-03 19:43 | buy  | 9164,49 |   0,028344 | 323331 |
| 2017-12-03 19:46 | _sell |   13999 |   0,043074  | 324999 |
| 2017-12-03 19:51 | buy  | 10412,4 |   0,032137  | 324001 |
| 2017-12-03 19:56 | buy  | 456,841 |    0,00141   | 324001 |
+------------------+------+---------+------------+--------+

But when we begin to reduce the balance of purchases / sales, we will see such things:
| 2017-12-03 14:31 | _sell |  236381 |    0,74101  | 318999 |  - sale of coins purchased earlier, and not included in our sample
| 2017-12-03 19:36 | buy  |  119698 |   0,369439 | 323999 | - purchase, sale of these coins will occur later

And as a result of such calculations, we will constantly receive a loss, well, it's logical - sales go after purchases, and next to the purchases we can have sales of coins purchased earlier. What to do in this case - do a sample of sales with a certain time lag after purchases , because neither the FIFI nor the LIFO method will help here.

Jump to: