From 9b6405dc30f6c65a8ef5f1775f68832849e22671 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Tue, 13 Feb 2024 12:19:30 -0800 Subject: [PATCH] Add example of options chain usage --- options_chain.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/options_chain.py b/options_chain.py index 508fa5c..ec224a8 100644 --- a/options_chain.py +++ b/options_chain.py @@ -38,4 +38,9 @@ class OptionsChain: return options.loc[options['Strike Distance'].idxmin()] def __repr__(self) -> str: - return str(self.options_chain) \ No newline at end of file + return str(self.options_chain) + +if __name__ == '__main__': + options_chain = OptionsChain('$SPXW.X', datetime.now()) + print(options_chain) + print(options_chain.closest_contract_by_credit(5.0, OptionType.PUT)) \ No newline at end of file