We use MTX technology to handle orders in our aggregation engine. All you need to do is sign a data structure that fits our protocol with the EIP-712 standard and post the data signed to our aggregation service. You can either do it manually or use our SDK. Here we'll demonstrate how to sign and put a limit order using our SDK.
We will skip the wallet creation.
// Cash corresponds the money in ordinary option tradeconstcash=awaitapis.cash();constexchange=newExchange({ chainId:ChainId.Ropsten, endpoint:ETH_ENDPOINT, addresses, vTokenAddress:"0x...",// The VToken Address cashAddress:cash.address,// The Cash Address});awaitexchange.init();// This step will compose an object and sign it with your walletconstorder=awaitexchange.buy( wallet,1.88,// Size2852.31,// Limit Price// Deadline, the helper method is imported from library, param unit is secondgetFutureExpiryInSeconds(1800) );// This step will upload your signed data to our backend for aggregationawaitapis.orderPutLimit("0x...",// VToken Address order,);
Sell Option
The sell option is very similar to the buying part; the only difference is to call a different function on the exchange class.
// Cash corresponds the money in ordinary option tradeconstcash=awaitapis.cash();constexchange=newExchange({ chainId:ChainId.Ropsten, endpoint:ETH_ENDPOINT, addresses, vTokenAddress:"0x...",// The VToken Address cashAddress:cash.address,// The Cash Address});awaitexchange.init();// This step will compose an object and sign it with your walletconstorder=awaitexchange.buy( wallet,1.88,// Size2852.31,// Limit Price// Deadline, the helper method is imported from library, param unit is secondgetFutureExpiryInSeconds(1800) );// This step will upload your signed data to our backend for aggregationawaitAPIs.orderPutLimit("0x...",// VToken Address order,);