Cryptocurrency Options
Use the exchange.SetContractType() function to set option contracts. Different exchanges have different option contract code formats. FMZ Quant Trading Platform supports the following cryptocurrency options exchanges:
-
Futures_Deribit
ForDeribitexchange, simply call theexchange.SetContractType()function to set the option contract. After setting the option contract, when calling market data interfaces likeGetTicker(), all retrieved data will be for that option contract.
For order placement, useexchange.Sell()andexchange.Buy()functions. When placing orders, pay attention to the trading direction and useexchange.SetDirection()to set the trading direction.
For order cancellation, useexchange.CancelOrder()function. To query positions, useexchange.GetPositions()function.Reference strategy code: Deribit Options Test Strategy
Option contract code examples:BTC-13SEP24-60000-C,XRP_USDC-27SEP24-1-C,BTC-CS-6SEP24-57000_57500,BTC-PCAL-20SEP24_13SEP24-55000, etc. -
Futures_OKX
Setting contracts, placing orders, canceling orders, querying orders, and getting market data operations are the same asDeribit. The contract code format isBTC-USD-200626-4500-C.
Contract-related information can be queried through thehttps://www.okx.com/api/v5/public/instrumentsinterface.For example, to query BTC option contract information:
javascriptfunction main() { Log(HttpQuery("https://www.okx.com/api/v5/public/instruments?instType=OPTION&uly=BTC-USD")) }pythonimport json import urllib.request def main(): ret = json.loads(urllib.request.urlopen("https://www.okx.com/api/v5/public/instruments?instType=OPTION&uly=BTC-USD").read().decode('utf-8')) Log(ret)c++void main() { Log(HttpQuery("https://www.okx.com/api/v5/public/instruments?instType=OPTION&uly=BTC-USD")); } -
Futures_HuobiDM
Huobi option contract code example:BTC-USDT-201225-P-13000, representing aBTCcontract with expiration date of December 25, 2020, option type PUT, and strike price of 13000 USD.
Call options: Buyer pays premium in USDT, using USDT from account assets; seller's margin is in coin, using coin from assets as collateral.
Put options: Buyer pays premium in USDT, using USDT from account assets; seller's margin is in USDT, using USDT from assets as collateral. -
Futures_Bybit
Supports Bybit exchange's USDC options. Set the trading pair toETH_USDCand call theexchange.SetContractType()function to set the option contract.
Option contract code example:ETH-25NOV22-1375-P. -
Futures_Aevo
Supports Aevo exchange's USDC options. Option contract code example:ETH-30JUN23-1600-C. -
Futures_GateIO
Supports GATE.IO exchange's USDT options. Option contract code example:BTC_USDT-20211130-65000-C.