使用 Robinhood API 数据通过期权事件进行期权交易的总损益计算

问题描述 投票:0回答:1

我正在编写一个 Chrome 扩展来计算 Robinhood 交易历史的总损益。

在计算到期、行权、转让等期权事件时,发现期权交易的总盈亏计算比我预期的要复杂。

我尝试思考所有可能的情况,并想出了一个我认为可行的公式,但希望得到其他人的关注,看看我是否遗漏了任何东西或做得完全错误。

// Option trading Profit / Loss occurrence

// Buy to open call options > Betting on Bullish
//    - TotalPL = (selling/expried premium * quantity) - (buying premium * quantity)
//    - Exercise (underlying_price * (quantity * 100)) - (strike_price * (quantity * 100))



// Sell to open call options > Betting on Bearish
//    - TotalPL = (buying premium * quantity) - (selling/expried premium * quantity)
//    - Assignment (strike_price * (quantity * 100)) - (underlying_price * (quantity * 100))
//
//    Example: Sell 2 of SPY $200 2023/01/06 call options at $10 premium (with the 200 shares of SPY as a collateral)
//    Senario 1) selling options before expiration
//      TotalPL = ($10 * 2) - (current premium at the time of selling * 2)
//    Senario 2) option expired in the money
//      TotalPL = ($10 * 2) - (0 * 2) >> current premium at the time of selling is $0. You keep all the credit. It is the same as senario 1.
//    Senario 3) option expired out of the money. SPY ended at $250 on 2023/01/06
//      TotalPL = ($200 * 200) - ($250 * 200)



// Buy to open put options > Betting on Bearish
//    - TotalPL = (selling/expried premium * quantity) - (buying premium * quantity)
//    - Exercise (strike_price * (quantity * 100)) - (underlying_price * (quantity * 100))



// Sell to open put options > Betting on Bullish
//    - TotalPL = (buying premium * quantity) - (selling/expried premium * quantity)
//    - Assignment (underlying_price * (quantity * 100)) - (strike_price * (quantity * 100))
javascript calculation stock trading algorithmic-trading
1个回答
0
投票

你有没有弄清楚这一点?我真的需要一些帮助。

© www.soinside.com 2019 - 2024. All rights reserved.