def test_index_name(self): name = stock.get_index_ticker_name("1001") self.assertEqual(name, "코스피") name = stock.get_index_ticker_name("2001") self.assertEqual(name, "코스닥") name = stock.get_index_ticker_name("1163") self.assertEqual(name, "코스피 고배당 50")
def make_index_dict(d: date, market: str = None): if market: tickers = stock.get_index_ticker_list(date_to_str(d), market=market) else: tickers = stock.get_index_ticker_list(date_to_str(d)) return {ticker: stock.get_index_ticker_name(ticker) for ticker in tickers}
def getTickerNameINDEX(self): logger.info("GetStockList - getTickerNameINDEX") for stockTicker in GetStockList.INDEX_KRPYX: try: self.tickerToName[stockTicker] = stock.get_index_ticker_name(stockTicker) except: self.tickerToName[stockTicker] = stockTicker logger.critical(f"GetStockList - getTickerNameINDEX; No name retrieved, ticker : {stockTicker}")
async def index_list(qDate: Optional[str] = None): result = [] date = getRecentDay() if qDate: date = qDate for ticker in stock.get_index_ticker_list(date): result.append({ticker: stock.get_index_ticker_name(ticker)}) return {"data": result}
def get_name(index): name = [] for idx in index: name.append(stock.get_index_ticker_name(idx)) time.sleep(1) return name
def _load_one(cls, ticker, fromdate: date, todate: date) -> Index: return Index(ticker=ticker, name=stock.get_index_ticker_name(ticker), data=get_index_ohlcv(ticker, fromdate, todate))