Trading Hub
Trading Functions
estimateMargin
Copy
function estimateMargin(
uint256 poolId,
uint256 amount,
uint256 slippage,
address[] calldata path
) external returns (uint256)
sellShort
Copy
function sellShort(
uint256 poolId,
uint256 amount,
uint256 estimatedMargin,
address[] calldata path
) public
Parameters:
Name | Type | Example |
poolId | uint256 | 138 |
buyCover
Copy
function buyCover(
uint256 poolId,
uint256 amount,
address[] calldata path
) public
getPositions
Get all positions of a specified user
Copy
function getPositions(
address account
) external view returns (address[] memory)
getOpenPositions
Copy
function getOpenPositions()
external view
returns (address[] memory _openPositions)
getClosingPositions
Copy
function getClosingPositions()
external view
returns (address[] memory _closingPositions)
getLegacyPositions
Copy
function getLegacyPositions()
external view returns (address[] memory _legacyPositions)
Position Functions
getPositionInfo
Copy
function getPositionInfo()
external
view
returns (
uint256 _closedBlock,
uint256 _closedPrice,
uint256 _totalMarginAmount,
uint256 _finishedBlock,
uint256 _dynamicAvgHoldPrice,
uint256 _totalFee,
uint256 _openBlock,
uint256 _unsettledCash,
uint256 _positionState,
uint256 _overdrawnBlock,
uint256 _lastestFeeBlock,
bool _closedFlag,
bool _liquidateFinished
)