{
    "Function": "getTakerNotionalPositionAndUnrealizedPnl",
    "File": "contracts/AMM.sol",
    "Parent Contracts": [
        "contracts/legos/Governable.sol",
        "node_modules/@openzeppelin/contracts/proxy/utils/Initializable.sol",
        "contracts/legos/Governable.sol",
        "contracts/Interfaces.sol"
    ],
    "High-Level Calls": [
        "IVAMM",
        "IVAMM",
        "SafeCast",
        "SafeCast",
        "SafeCast",
        "SafeCast",
        "SafeCast",
        "SafeCast"
    ],
    "Internal Calls": [],
    "Library Calls": [
        "toInt256",
        "toUint256",
        "toUint256",
        "toInt256",
        "toInt256",
        "toInt256"
    ],
    "Low-Level Calls": [],
    "Code": "function getTakerNotionalPositionAndUnrealizedPnl(address trader) override public view returns(uint takerNotionalPosition, int256 unrealizedPnl) {\n        Position memory position = positions[trader];\n        if (position.size > 0) {\n            takerNotionalPosition = vamm.get_dy(1, 0, position.size.toUint256());\n            unrealizedPnl = takerNotionalPosition.toInt256() - position.openNotional.toInt256();\n        } else if (position.size < 0) {\n            takerNotionalPosition = vamm.get_dx(0, 1, (-position.size).toUint256());\n            unrealizedPnl = position.openNotional.toInt256() - takerNotionalPosition.toInt256();\n        }\n    }"
}