2 - Trading

IVX DIEM => 
struct TradeInfo {
        uint256 optionID;
        uint256 amountContracts; //number of contracts to open
    }

function openTrades(TradeInfo[] calldata traded) external

The above function is called to open trades, it only requires that the user has an IVX Portfolio contract, and that it is not eligible for liquidation.

amount of contracts is a 1e18 number where 1e18 represents 1 contract to open, this allows for a huge fractional amount of contracts to be open.

optionID is given by the IVX Diem Token contract, that option attributes can be queried from

struct OptionAttributes {
    Option option;
    bool isCall;
    bool isBuy;
    OptionStatus status;
}
function getOptionIDAttributes(uint256 _optionID) external view returns (OptionAttributes memory);

To query the latest option id created,

function currentOptionId() external view returns (uint256);

the option ids are given in the following pattern: first options, all with same strike and expiry:

id 1 = buy call ;

id 2 = sell call ;

id 3 = buy put ;

id 4 = sell put ;

second options, all with same strike and expiry, but different then the above ones:

id 5 = buy call ;

id 6 =sell call ;

id 7 = buy put ;

id 8 = sell put ;

Last updated