-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于Portfolio里做空和做多的account_balance.cash计算疑惑 #29
Comments
期貨short interest是零,股票做空有成本,short interest不為零。 |
作者你好,我理解期货做空,direction=SHORT,offset=OPEN,cash应该做减法,为什么Portfolio里计算cash做加法呢。 |
你好,这里的cash是资产负债表的概念,做空时相当于把这个资产以当前价格卖出(所以cash增加) |
代码如下:
1.股票:
direction=LONG开仓下是cash会减少,direction=SHORT卖出account_balance.cash余额增加,这是没有问题的。
2.期货:
direction=LONG下如果offset=CLOSE为什么cash也用减法并且还有一个account_balance.cash -= short_interest。
direction=SHORT下如果offset=OPEN为什么cash还用加法呢(self.account_balance.cash += price * quantity * lot_size)。
问题是股票我能理解,买入和卖出的金额,但是期货的做多和做空,金额的变化不太理解。希望作者能帮忙解惑期权期货Portfolio里的update逻辑怎么解释。
The text was updated successfully, but these errors were encountered: