FX Swap is a of with functions , keys and example object that represents an fx swap whereby two currencies DOM (the source currency) and FOR (the target currency) are exchanged at some initial time and then again - but with the opposite direction - at some time later.
It is represented as a special case of an with two legs, where the first leg corresponds to DOM and the second leg to FOR
If the direction of the cash flows amounts to borrowing FOR against lending DOM, the swap's direction type is set as BORROW, otherwise is set as LEND
More specifically, at inception the holder of an fx swap of the BORROW type pays n1 units of DOM and receives n2 units of FOR
At maturity the same party receives N1 units of DOM and pays N2 units of FOR
The notionals n1, n2, N1, N2 are contractually specified so that the value of the swap equals 0 when it is entered.
This is equivalent to the ratios n2/n1 and N2/N1 equaling the spot and forward fx rates respectively of the pair DOM/FOR as these are observed at that time.
As the market fx rates keep changing, the notionals remain fixed and the swap's value will inevitably deviate from 0.
Note that the market practice for quoting the ongoing fx swap transactions are not by their price - which equals 0 anyway - but by the spread between the forward fx (N2/N1) and the spot fx (n2/n1)