Traders or Takers
Introduction
Takers are the traders who take a long/short position by buying/selling from/to the AMM.
// contract: ClearingHouse/*** @notice Open/Modify/Close Position* @param idx AMM index* @param baseAssetQuantity Quantity of the base asset to Long (baseAssetQuantity > 0) or Short (baseAssetQuantity < 0)* @param quoteAssetLimit Rate at which the trade is executed in the AMM. Used to cap slippage.*/function openPosition(uint idx, int256 baseAssetQuantity, uint quoteAssetLimit) external;
- Check Open position size, open notional, unrealized PnL, average open value
// contract: HubbleViewerstruct Position { int256 size; uint256 openNotional; int256 unrealizedPnl; uint256 avgOpen; int256 funding;}/*** @notice Get information about all user positions* @param trader Trader for which information is to be obtained* @return positions in order of amms* positions[i].size - BaseAssetQuantity amount longed (+ve) or shorted (-ve)* positions[i].openNotional - $ value of position* positions[i].unrealizedPnl - in dollars. +ve is profit, -ve if loss* positions[i].avgOpen - Average $ value at which position was started*/function userPositions(address trader) external view returns(Position[] memory positions);
- Get quote for opening a long/short position
// contract: HubbleViewer/*** @notice calculate amount of quote asset required for trade* @param baseAssetQuantity base asset to long/short* @param idx amm index*/function getQuote(int256 baseAssetQuantity, uint idx) external view returns(uint256 quoteAssetQuantity);
Funding Payments
Funding payments are an essential ingredient of any perps exchange. To that end, taker’s pay or receive the funding payment on their open position at the time of funding event. Taker’s pending funding payment can be queried as follows:
Discover more in the Maker's Funding Payment section.
Liquidations
Your position will get liquidated in 4 chunks (25% each) - not all at once.
This saves the trader many a times - for e.g.
- they may come out of liquidation zone after a partial liquidation
- Market may recover
- Trader has more time to close the position
So they pay liquidation penalty only on the liquidated part.
Notes
- Price deviations: Longs are not allowed when markPrice (mp) > 1.2 * index and shorts aren't allowed when mp < .8 ** index. Do note that even in such condition, longs/shorts arising from liquidations are still allowed.
- Minimum Position size: (TBD)
Table of Contents