Implement a string representation of the options chain

This commit is contained in:
moshferatu 2024-02-13 08:36:20 -08:00
parent 7119af4e34
commit a0f4b62f65

View File

@ -36,3 +36,6 @@ class OptionsChain:
options = self.options_by_type(option_type) options = self.options_by_type(option_type)
options['Strike Distance'] = abs(options['Strike'] - target_strike) options['Strike Distance'] = abs(options['Strike'] - target_strike)
return options.loc[options['Strike Distance'].idxmin()] return options.loc[options['Strike Distance'].idxmin()]
def __repr__(self) -> str:
return str(self.options_chain)