Digital currency options strategy back to basics

Author: The Little Dream, Created: 2020-08-11 14:21:28, Updated: 2023-09-27 19:40:42

img

Digital currency options strategy back to basics

Recently the inventors of the quantitative trading platform upgraded the retesting system to support the retesting of digital currency options, this time supporting the retesting of digital currency options.DeribitSome options data on the exchange. So we have better tools for learning options trading, as well as strategy verification.

Deribit option reassessment

Defined in the retesting systemDeribitOptions are European in nature, with a contract value of 1 BTC.BTC-7AUG20-12750-C

Signature Date of entry into force The price of the power (Ball and up) Options
BTC 7AUG20 12750 C
Bitcoin Right of way August 7, 20 The price of the ticket is 12750. See also Options
BTC 7AUG20 12750 P
Bitcoin Right of way August 7, 20 The price of the ticket is 12750. Options to decline

In the same way as digital currency futures, it is also possible to set up contracts, acquire holdings, etc. Set up a contract:exchange.SetContractType("BTC-7AUG20-12750-C")Acquiring a holding:var pos = exchange.GetPosition()

The price of an option contract is the amount of an option contract that the option buyer must pay to the option seller. The buyer obtains the option rights, the seller has the obligation rights. The option contract is tradable before the option rights (e.g. breakeven, closing obligation).

Common options trading portfolios

In addition to selling the options, the company is also selling the options for cash.

/*backtest
start: 2020-07-27 00:00:00
end: 2020-08-05 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Deribit","currency":"BTC_USD"},{"eid":"OKEX","currency":"BTC_USDT","balance":100000}]
*/

function main() {
    exchanges[0].SetContractType('BTC-7AUG20-12750-C');
    var initSpotAcc = _C(exchanges[1].GetAccount)
    var isFirst = true
    while(true) {
        var optionTicker = exchanges[0].GetTicker()
        var spotTicker = exchanges[1].GetTicker()
        if(isFirst) {
            exchanges[0].SetDirection("sell")
            exchanges[0].Sell(optionTicker.Buy, 1)
            exchanges[1].Buy(spotTicker.Sell, 1)
            
            isFirst = false 
        }
        
        var optionPos = _C(exchanges[0].GetPosition)
        var nowSpotAcc = _C(exchanges[1].GetAccount)
        var diffStocks = (nowSpotAcc.Stocks - initSpotAcc.Stocks)
        var diffBalance = (nowSpotAcc.Balance - initSpotAcc.Balance)
        var spotProfit = diffBalance + diffStocks * spotTicker.Last
        var optionProfit = optionPos[0].Profit * spotTicker.Last
        LogProfit(spotProfit + optionProfit)
        $.PlotLine("现货", spotProfit)
        $.PlotLine("期权", optionProfit)
        Sleep(500)
    }
}

img

Options can provide a degree of hedging protection for purchased assets. They are generally used when the option is positive and the option is willing to be held. The risk is that the option price falls, and although the option can compensate for a certain amount of the loss in the spot market, the net loss occurs after the loss exceeds the amount of the option.

In addition, the liquidity of the digital currency options market in general, often sometimes does not find a counter; this is also a problem to consider.

Similarly, we can replace the spot to the futures, the code is as follows:

/*backtest
start: 2020-07-27 00:00:00
end: 2020-08-05 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Deribit","currency":"BTC_USD"},{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
*/

function main() {
    exchanges[0].SetContractType('BTC-7AUG20-12750-C');
    exchanges[1].SetContractType("quarter")
    var isFirst = true
    while(true) {
        var optionTicker = exchanges[0].GetTicker()
        var futuresTicker = exchanges[1].GetTicker()
        if(isFirst) {
            exchanges[0].SetDirection("sell")
            exchanges[0].Sell(optionTicker.Buy, 1)
            
            exchanges[1].SetDirection("buy")
            exchanges[1].Buy(futuresTicker.Sell, _N(1 * futuresTicker.Sell / 100, 0))
            
            isFirst = false 
        }
        
        var optionPos = _C(exchanges[0].GetPosition)
        var futuresPos = _C(exchanges[1].GetPosition)
        
        
        var futuresProfit = futuresPos[0].Profit 
        var optionProfit = optionPos[0].Profit
        LogProfit(futuresProfit + optionProfit)
        $.PlotLine("期货", futuresProfit)
        $.PlotLine("期权", optionProfit)
        Sleep(500)
    }
}

The results are as follows:img

Futures can reduce the amount of money they hold compared to cash, but the risk is somewhat higher compared to cash.

In addition, there are many other options trading portfolios:

  • Bull market bull call spread
  • The bear market is falling, bear put spread

Interested can research it in a retesting system.


Related

More