From 7e7ef73be45deb318f2ea14bfddb85a5266fa53d Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 6 Dec 2017 21:49:24 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=E4=BF=AE=E5=A4=8D=E5=B8=8C=E8=85=8A?= =?UTF-8?q?=E5=80=BC=E8=AE=A1=E7=AE=97=E7=9A=84=E4=B9=98=E6=95=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/app/optionMaster/omBase.py | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/vnpy/trader/app/optionMaster/omBase.py b/vnpy/trader/app/optionMaster/omBase.py index e82e021a..d5a4f1c6 100644 --- a/vnpy/trader/app/optionMaster/omBase.py +++ b/vnpy/trader/app/optionMaster/omBase.py @@ -145,7 +145,7 @@ class OmUnderlying(OmInstrument): #---------------------------------------------------------------------- def calculatePosGreeks(self): """计算持仓希腊值""" - self.posDelta = self.theoDelta * self.netPos * self.size + self.posDelta = self.theoDelta * self.netPos ######################################################################## @@ -218,21 +218,26 @@ class OmOption(OmInstrument): if not underlyingPrice or not self.pricingImpv: return - self.theoPrice, self.theoDelta, self.theoGamma, self.theoTheta, self.theoVega = self.calculateGreeks(underlyingPrice, - self.k, - self.r, - self.t, - self.pricingImpv, - self.cp) + self.theoPrice, delta, gamma, theta, vega = self.calculateGreeks(underlyingPrice, + self.k, + self.r, + self.t, + self.pricingImpv, + self.cp) + + self.theoDelta = delta * self.size + self.theoGamma = gamma * self.size + self.theoTheta = theta * self.size + self.theoVega = vega * self.size #---------------------------------------------------------------------- def calculatePosGreeks(self): """计算持仓希腊值""" self.posValue = self.theoPrice * self.netPos * self.size - self.posDelta = self.theoDelta * self.netPos * self.size - self.posGamma = self.theoGamma * self.netPos * self.size - self.posTheta = self.theoTheta * self.netPos * self.size - self.posVega = self.theoVega * self.netPos * self.size + self.posDelta = self.theoDelta * self.netPos + self.posGamma = self.theoGamma * self.netPos + self.posTheta = self.theoTheta * self.netPos + self.posVega = self.theoVega * self.netPos #---------------------------------------------------------------------- def newTick(self, tick):