I
I
Inter Carpenter2016-09-14 23:32:35
Mathematics
Inter Carpenter, 2016-09-14 23:32:35

How to count currency transactions?

Hello
There is a project - an exchange of electronic currency (kiwi, poison, savings, bitcoin, perfect and others)
Task: calculate the income for each individual exchange operation
Data: a stack of exchange operations
How to calculate the profit from each individual operation.
I tried several methods:
1. I took the exchange operation, then searched the database for the reverse exchange operation, looked at its rate (calculated the purchase rate), then calculated the difference in rates and multiplied by the amount. But problem 1 - the profitability is calculated from 2 operations. 2 - the amount of the operation is different. 3 - the reverse rate is not correct from the point of view of calculation (since let's say a person exchanges kiwi for bitcoin, we are trying to take the operation of exchanging bitcoin for kiwi, and this bitcoin could be bought for perfect money)
2. Since the selling rate is not accurate due to the fact that the currency being sold could be bought for a completely different currency than we buy, I did the calculation as follows: We are searching for what we bought bitcoin and for what currencies, let's say for 6 hours and each currency is then converted at the bitcoin selling rate and everything is added together and the buying rate is calculated. But the counting process was also not crowned with success.
I can't think of a calculation algorithm. Now I’m thinking in the direction that you need to take the initial balance values ​​\u200b\u200bin the beginning of the day, then view all the exchange chains for the day and calculate income from this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2016-09-14
@dimonchik2013

1) the first - strictly no
2) the second - a consequence of the first
with balances at the beginning and end of the day - the
easiest way is to ask the accountant or me (500re)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question