I have been thinking about how to set up a CFD trading project but have a problem someone might know a solution to.
Lets say trader A wants to go long on AAPL shares for 1000 shares @ $500usd, and trader B agrees to go short AAPL for 400 shares @ $500usd. A position is matched and created for both traders for 400 shares @ $500.
AAPL goes up in price to $600usd a share.
If trader B wants to liquidate his loss there shouldn't be a problem because trader A will happily take the profit. However what if trader A wants to liquidate which forces trader B to "realize" the loss. In a market with high liquidity a potential buyer of trader A's long position could be found to take its position. However in a low liquidity market there probably wont be anyone to assume trader A's long position and after trader B "realizing" the loss there may be no one to take up a new matching position with trader B for him to recoup his losses on any downward swing.
What about if the profiting trader wants to liquidate he only gets 50% of the profit, so that the loosing trader only realizes half the loss? Still pretty shitty for the loosing trader.
Or is it a known risk in a low liquidity market that you may not be able to liquidate easily?
It is a known risk
but either way, if you implement something like daily settlement with a margin account, the potential losses from one of the counterparties getting cold feet are much more limited.