efinance
efinance copied to clipboard
Enhancement on stock.get_quote_history API
Resolves #128
This PR enhanced stock.get_quote_history API with the following aspects:
- Exact symbol match.
- Add MarketType enum for searching stock symbol on specified stock market.
- Expose toggling on cached EastMoney stock id.
- Enrich corresponding comments.
Feature examples:
import efinance as ef
ef.stock.get_quote_history("PG")
# unexpectedly returns AAPL's stock history
# get history of stock, whose symbol exactly matches "PG"
ef.stock.get_quote_history("PG", quote_symbol_mode=True, use_id_cache=False) # do not use cache as it will still matches AAPL
# Correctly returns P&G stock history
# fuzzy search "PG" in A stock market
ef.stock.get_quote_history("PG", market_type=ef.utils.MarketType.A_stock, use_id_cache=False)
# returns 平高电气 stock history
# exact search "PG" in A stock market
ef.stock.get_quote_history("PG", market_type=ef.utils.MarketType.A_stock, quote_symbol_mode=True, use_id_cache=False)
# returns empty dataframe as none matches in reality