and manage to buy 250 xrp then the price rises and you buy another 300 at 0.1224 it then rises again and you buy another 150 at 0.1229 and another 300 at 0.1231.
Now the weighted average is 0.122585 ((250×0.1220+300×0.1224+150×0.1229+300×0.1231) / (250+300+150+300) = 0.122585) of the buy orders. However I assume that CAT will sell once it sees that it bought something. Lets say the first 2 orders ( the 250 and 300) get sold at 0.1314 and the other 2 (150 and 300) get sold at 0.1311.
Can you tell me what CAT does to calculate these profits? I assume it will use the history api for this to check if it bought and sold?
Now the weighted average is 0.122585 ((250×0.1220+300×0.1224+150×0.1229+300×0.1231) / (250+300+150+300) = 0.122585) of the buy orders. However I assume that CAT will sell once it sees that it bought something. Lets say the first 2 orders ( the 250 and 300) get sold at 0.1314 and the other 2 (150 and 300) get sold at 0.1311.
Can you tell me what CAT does to calculate these profits? I assume it will use the history api for this to check if it bought and sold?
when TradeHistory API is available, things are simple.
In that case you will have 3 trades
250 at 0.1220
300 at 0.1224
150 at 0.1229
300 at 0.1231
So from 1 PING you will have 4 PONG with 4 Different reference price.
But let's say all orders first fill (the 1000). And you manage to sell only 600. How do you know which is sold?
Any Order have an OrderID
And Any Trade have a TradeId + OrderID
So i have the relationship between any order and his trades.