Position calculation:
Margin x leverage / opening price
Profit and loss calculation:
Profit and loss for a long position = (closing price - opening price) x purchased position
Profit and loss for a short position = (opening price - closing price) x purchased position