btb.libstocks package
Submodules
btb.libstocks.stocks module
- synopis:
An aggregation of stock data with a simple API.
- class btb.libstocks.stocks.Stocks(index=None)[source]
Bases:
objectProvides stock data for a selected stock from the top 1000 measured by market capitial.
- Parameters:
index (int) – Index for selected stock into the list of stocks sorted by market capitalization. If not specified a random index will be selected, defaults to None.
- property country: str
Returns the contry of the selected stock. For this data set all stocks are U.S. stocks.
- Returns:
Country.
- property description: str
Returns a short description of the selected stock.
- Returns:
Stock description.
- property divdend: str
Returns the dividend yield of the selected stock. A dividend is a distribution of a portion of a company’s earnings, decided by the board of directors, paid to a class of its shareholders.
- Returns:
Dividend yield.
- find_ticker_by_instrument_id(instrument_id) str[source]
Uses a Robinhood instrument ID to find the associated stock ticker within the data set.
- Parameters:
instrument_id (str) – Instrument ID used to find associated stock ticker.
- Returns:
Stock ticker.
- property market_cap: str
Returns the market capitalization of the selected stock. Market capitalization is the total dollar value of all outstanding shares of a company at the current market price.
- Returns:
Market capitalization.
- property sector: str
The sector of the selected stock. The market sector is a part of the economy, usually broader than an industry. Two industries may form part of one market sector. The eleven sectors are:
Communication services
Consumer discretionary
Consumer staples
Energy
Financials
Healthcare
Industrials
Information technology
Materials
Real estate
Utilities
- Returns:
Sector.