-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
OptionStrategies
for Iron Butterfly
#8072
OptionStrategies
for Iron Butterfly
#8072
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Minor comments shared
@@ -350,6 +350,21 @@ public static ImmutableList<OptionStrategyDefinition> AllDefinitions | |||
(legs, p) => p.Expiration > legs[0].Expiration) | |||
); | |||
|
|||
/// <summary> | |||
/// Iron Butterfly strategy consists of a long ATM call, a long ATM put, a short OTM call, and a short OTM put. | |||
/// The strike spread between ATM & OTM call and put are the same. All at the same expiration date. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&
breaks the summary, should be and
👍
Sure long ATM call, a long ATM put, a short OTM call, and a short OTM put.
is right? I think the sides are the other way round, we sell ATM take a profit and protect us with the bought contracts OTM
See https://www.investopedia.com/articles/active-trading/030314/what-iron-butterfly-option-strategy.asp
For example, let's say ABC Co. rallied to $50 in August and the trader wants to use an iron butterfly to generate profits. The trader writes both a September 50 call and put, receiving a $4.00 premium for each contract, and also buys a September 60 call and September 40 put for $0.75 each.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this example is Short the Iron Butterfly. Iron Butterfly is made up by a bear call spread and a bull put spread, so OTM ones are shorting. You can a description of "Short" in https://en.wikipedia.org/wiki/Iron_butterfly_(options_strategy)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase from master, the regression test interface was changed & a unit test CI bug was shipped |
f7bf2c4
to
c4ddee9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some contradiction on the definitions and examples of Iron butterfly available online in difference sources, we will follow the definition of fidelity & wiki
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some contradiction on the definitions and examples of Iron butterfly available online in difference sources, we will follow the definition of fidelity & wiki
Never mind, after re reviewing all sources we should match tasty/ib/investopedia, please revert implementation names
fidelity, wikipedia say A -> this PR
-even wikipedia actually calls Long iron butterfly (reverse iron butterfly) -> meaning the 'short' is the iron butterfly
tasty, IB, investopedia say B
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 👍
Description
Add
OptionStrategies
abstraction helper method for Iron Butterfly.Definition:
https://www.investopedia.com/terms/i/ironbutterfly.asp
https://www.fidelity.com/learning-center/investment-products/options/options-strategy-guide/long-iron-butterfly-spread
https://www.fidelity.com/learning-center/investment-products/options/options-strategy-guide/short-iron-butterfly-spread
https://www.optionseducation.org/strategies/all-strategies/long-iron-butterfly
https://www.optionseducation.org/strategies/all-strategies/short-iron-butterfly
Margin for long Iron Butterfly (short iron condor with same strike for middle strikes):
![long-iron-butterfly](https://private-user-images.githubusercontent.com/56447733/336371361-d0834efa-2c7b-4180-8aa0-7cc3b0ea1549.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1OTA3OTEsIm5iZiI6MTcxOTU5MDQ5MSwicGF0aCI6Ii81NjQ0NzczMy8zMzYzNzEzNjEtZDA4MzRlZmEtMmM3Yi00MTgwLThhYTAtN2NjM2IwZWExNTQ5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI4VDE2MDEzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ1YTkwMDg1YjI4MWMwN2FkZGJjNTQ3ZDQ2M2Q2MDhlODgzZTc5YmQwNjdkYzM2ZTBjNTk2ZjA3MWU2Y2FmMzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.eh1jBSeDCleF-xemVGXKfZrcDgnQyuLoS49uKCUqsHg)
Expected: 0; actual: 0
Margin for short Iron Butterfly (long iron condor with same strike for middle strikes):
![short-iron-butterfly](https://private-user-images.githubusercontent.com/56447733/336371583-7bfec3ea-55f2-41c0-825c-0146d5ef04a3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1OTA3OTEsIm5iZiI6MTcxOTU5MDQ5MSwicGF0aCI6Ii81NjQ0NzczMy8zMzYzNzE1ODMtN2JmZWMzZWEtNTVmMi00MWMwLTgyNWMtMDE0NmQ1ZWYwNGEzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI4VDE2MDEzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ1MDU4ZDBkNTRjOGRmYzk3YzU3YWM3YmM1OGJiZGY0YTI5ZGVhNGZjYmNhNTA2NzQxNjliMmNkZWI4OTc0NjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.mKQ-FadeeMfPbzUzJp4mHIFP57XBou-u20xBYFrDbR0)
Expected: 1000; actual: 1000 (+10 for 1% commission)
Add Short version of Iron Butterfly and Iron Condor
Related Issue
NA
Motivation and Context
Missing feature
Requires Documentation Change
Add helper method usage in
How Has This Been Tested?
Types of changes
Checklist:
bug-<issue#>-<description>
orfeature-<issue#>-<description>