Last active
October 20, 2022 05:35
-
-
Save quantra-go-algo/62607b3c7b7352de3b8ac1b4bd069e88 to your computer and use it in GitHub Desktop.
Get price to book
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get price to book | |
pb = msft.info['priceToBook'] | |
pe = msft.info['regularMarketPrice']/msft.info['trailingEps'] | |
print('Price to Book Ratio is: %.2f' % pb) | |
print('Price to Earnings Ratio is: %.2f' % pe) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
get price to book
pb = msft.info['priceToBook']
pe = msft.info['regularMarketPrice']/msft.info['epsTrailingTwelveMonths']
print('Price to Book Ratio is: %.2f' % pb)
print('Price to Earnings Ratio is: %.2f' % pe)
KeyError: 'epsTrailingTwelveMonths'