Sumber dimuat naik... memuat...

derbit Pilihan Ujian Kembali

Penulis:Pencipta Kuantiti, Tarikh: 2020-08-06 17:41:45
Tag:Pilihan

  • Logik membeli dan menjual opsyen derbit
  • Sokongan untuk pilihan beli dan jual
  • Oleh kerana hak jalan perlu digabungkan dengan harga niaga hadapan, untuk masa ini tidak menyokong hak jalan, cakera fizikal boleh melakukan hak jalan melalui antara muka IO

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

function main() {
    exchange.SetContractType('BTC-7AUG20-12750-C');
    var ticker = exchange.GetTicker();
    Log(ticker);
    exchange.SetDirection("sell");
    var orderId = exchange.Sell(ticker.Sell, 10);
    Log(exchange.GetAccount());
    Log(exchange.GetOrders());
    exchange.CancelOrder(orderId);
    Log(exchange.GetAccount());
    
    
    exchange.Sell(ticker.Buy, 10);
    Log(exchange.GetAccount());
    Log(exchange.GetPosition());
    ticker = exchange.GetTicker();
    exchange.SetDirection("closesell");
    exchange.Buy(ticker.Sell, 10);
    Log(exchange.GetAccount());
    Log(exchange.GetPosition());
    
    
    
    ticker = exchange.GetTicker();
    Log(ticker);
    exchange.SetDirection("buy");
    orderId = exchange.Buy(ticker.Buy, 10);
    Log(exchange.GetAccount());
    exchange.CancelOrder(orderId);
    Log(exchange.GetAccount());
    
    
    exchange.Buy(ticker.Sell, 10);
    Log(exchange.GetAccount());
    Log(exchange.GetPosition());
    ticker = exchange.GetTicker();
    exchange.SetDirection("closebuy");
    exchange.Sell(ticker.Buy, 10);
    Log(exchange.GetAccount());
    Log(exchange.GetPosition());
}

Berkaitan

Lebih lanjut

741262008cjzApa maksudnya? Adakah ia bermakna anda boleh mendapatkan data dengan cara biasa dengan menetapkan simbol?