What is margin trading? What does it mean to go long or short?

Margin trading lets you leverage bitcoin you already own as collateral for a loan to buy additional bitcoin.
Here’s an example of a long trader, who expects the price of BTC to go up: Suppose you use $5,000 worth of BTC to borrow an additional $5,000 worth of BTC on margin to buy a total of $10,000 in BTC. If BTC rises in value to $11,000 and you sell it, you would pay back the $5,000 borrowed on margin and realize a profit of $1,000 (minus transaction fees). That’s a 20% return on your $5,000 investment. If you didn’t use a margin loan, you would have paid $10,000 for BTC. Not only would you have tied up an additional $5,000, but you would have realized only a 10% return on your investment. The 10% difference in the return is the result of leveraging your bitcoin.
However, leverage works as dramatically when the price of BTC falls as when it rises. For example, let’s say you use $5,000 in BTC and borrow an additional $5,000 of BTC on margin to purchase a total of $10,000 in BTC. Suppose the market value of the BTC you’ve purchased for $10,000 drops to $9,000. Your position would fall to a value of $4,000, which is the market value minus the loan balance of $5,000. In this instance, you could suffer a loss of 20% due to a 10% decrease in the price of BTC.

A short trader, on the other hand, who expects the price of bitcoin to go down, borrows bitcoin and then sells it with the expectation that it will lose value. If they are right, they can then purchase BTC at its lower price and repay the borrowed funds, realizing a gain on their trade.

How does lending work?

How are positions liquidated? Is there liquidity risk?

Are the smart contracts safe? Can I see the Audits?