Let's look at an example. An FX trader has undertaken some positions in CNY/JPY throughout the day. They are: 
Summing these transactions gives the FX trader a long position of CNY 10 million. This implies that the trader has a corresponding short position in JPY.
The size of this short position can be determined as follows: 
Short JPY Position
JPY sold 
=[CNY 15 million x JPY 16.4538] + [CNY 10 million x JPY 16.4499] + [CNY 5 million x JPY 16.4521] 
= JPY 246,807,000 + JPY 164,499,000 + JPY 82,260,500 
= JPY 493,566,500
Long JPY Position
JPY bought
= [CNY 10 million x JPY 16.4587] + [CNY 10 million x JPY 16.4592] 
= JPY 164,587,000 + JPY 164,592,000 
= JPY 329,179,000
Net JPY Position
JPY net position
= Total JPY sold – Total JPY bought 
= JPY 493,566,500 – JPY 329,179,000 
= JPY 164,387,500
Therefore, the average rate can be calculated as follows: 
Average rate = JPY 164,387,500 / CNY 10,000,000 
                           = CNY/JPY 16.44 (rounded)