Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

OpenAccountingLib

Git Source

Functions

buildOpenState

function buildOpenState(
    OpenInputs memory inputs
) internal pure returns (OpenState memory state);

effectiveMarginAfterTradeCost

function effectiveMarginAfterTradeCost(
    uint256 marginUsdc,
    int256 tradeCostUsdc
) internal pure returns (uint256 effectiveMarginUsdc);

Structs

OpenInputs

struct OpenInputs {
    uint256 currentSize;
    uint256 currentEntryPrice;
    CfdTypes.Side side;
    uint256 sizeDelta;
    uint256 price;
    uint256 capPrice;
    uint256 preSkewUsdc;
    uint256 postSkewUsdc;
    uint256 vaultDepthUsdc;
    uint256 executionFeeBps;
    int256 currentFundingIndex;
    CfdTypes.RiskParams riskParams;
}

OpenState

struct OpenState {
    uint256 addedMaxProfitUsdc;
    uint256 oldEntryNotional;
    uint256 newEntryPrice;
    uint256 newSize;
    uint256 newEntryNotional;
    uint256 postSkewUsdc;
    int256 positionFundingContribution;
    int256 vpiUsdc;
    uint256 notionalUsdc;
    uint256 executionFeeUsdc;
    int256 tradeCostUsdc;
    uint256 maintenanceMarginUsdc;
    uint256 initialMarginRequirementUsdc;
}