local Titles, Entries, Desk = {}, {}, {} local Wn1_Hndl local Wn1_Field1, Wn1_Field2, Wn1_Field3, Wn1_Field4, Wn1_Field5 = "Код CALL", "Страйк", "Дельта CALL", "Дельта расч", "Теор. расч" function OnInit (scriptPath) qu = require ("QuikUtil(qu)") -- qc, lu, tu blk = require ("BlackScholes(blk)") glb_ScriptDir, glb_ScriptName = lu.SplitPath (scriptPath) message (glb_ScriptName .." started") server = require ("OptionDesk") end -- OnInit() function OnStop (signal) if Wn1_Hndl then DestroyTable (Wn1_Hndl) end StopFlag = true return 1000 -- 1 sec end local function ShowWin (cols) for k = 1, #Desk do local calCode = Desk[k][Entries[Wn1_Field1]] if calCode:sub (3,3) == "0" then calCode = calCode:sub (1,2) .
ShortStraddleWeeklyVola Si__01_191201_200331 nn ;xDate ;nVola ;nCal ;nPut ;xCal ;xPut ;win 1;26.12.2019; 8.29; 312.76; 265.76; 0.00; 128.00; 428.73 2;30.12.2019; 8.69; 285.41; 178.41; 0.00; 296.00; 147.19 3;09.01.2020; 8.88; 376.41; 356.41; 0.00; 653.00; 56.50 4;16.01.2020; 8.73; 352.96; 248.96; 372.00; 0.00; 207.90 5;23.01.2020; 8.29; 346.55; 229.55; 397.00; 0.00; 157.34 6;30.01.2020; 8.02; 228.69; 330.69; 1238.00; 0.00; -700.22 7;06.02.2020; 8.84; 297.97; 324.97; 0.00; 56.00; 544.70 8;13.02.2020; 9.66; 294.12; 390.12; 6.00; 0.00; 655.40 9;20.02.2020; 9.07; 323.48; 315.48; 545.00; 0.00; 71.58 10;27.02.2020; 9.41; 352.94; 315.94; 2218.00; 0.00; -1571.80 11;05.03.2020; 12.99; 461.79; 492.79; 666.00; 0.00; 263.04 12;12.03.2020; 16.47; 554.66; 671.66; 7254.00; 0.00; -6055.94 13;19.03.2020; 40.75;1711.52;1598.52; 5132.00; 0.00; -1871.05 ShortStraddleWeeklyVola Si__01_200301_200630 nn ;xDate ;nVola ;nCal ;nPut ;xCal ;xPut ;win 1;26.03.2020; 28.46;1257.44;1281.44; 0.00; 2742.00; -244.51 2;02.04.2020; 19.85; 879.34; 832.34; 393.00; 0.00; 1285.56 3;09.04.2020; 21.79; 917.41; 972.41; 0.00; 4116.00; -2261.08 4;16.04.2020; 19.84; 783.15; 850.15; 540.00; 0.00; 1060.97 5;23.04.2020; 20.62; 878.35; 831.35; 44.00; 0.00; 1632.60 6;30.04.2020; 20.48; 899.03; 801.03; 0.00; 450.00; 1217.06 7;07.05.2020; 18.47; 758.18; 762.18; 0.00; 328.00; 1161.15 8;14.05.2020; 36.60;1469.80;1531.80; 70.00; 0.00; 2885.59 9;21.05.2020; 17.27; 755.28; 664.28; 0.00; 3033.00; -1643.63 10;28.05.2020; 15.76; 609.33; 631.33; 0.00; 511.00; 701.26 11;04.06.2020; 28.50;1119.53;1108.53; 0.00; 1272.00; 917.77 12;11.06.2020; 16.22; 617.76; 627.76; 240.00; 0.00; 977.06 13;18.06.2020; 14.49; 555.47; 545.47; 0.00; 499.00; 574.93Вот график тестирования с 2018 года.
for (int i = i0; i < weeks.Count; ++i) { int idxIni = IndexOf (weeks[i][0]-1, entryTime); int idxFin = IndexOf (weeks[i][1], exitTime); double strike = mwu.RoundTo (Open[idxIni], strikeStep); double dura = (Date[idxFin] - Date[idxIni]).TotalDays; double calIni = OptPrice ('C', Open[idxIni], strike, dura, volaIni); double putIni = OptPrice ('P', Open[idxIni], strike, dura, volaIni); double calFin = OptPrice ('C', Close[idxFin], strike, 1e-6, volaFin); double putFin = OptPrice ('P', Close[idxFin], strike, 1e-6, volaFin); double win = (calIni+putIni) * (1-slpg) - (calFin+putFin) - 2*fee; PrintDebug (String.Format (fmt, i, Date[idxFin].ToShortDateString() ,calIni, putIni, calFin, putFin, win)); } // for (int i = i0Вот выдача за первый квартал