Beispiel #1
0
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}
Beispiel #2
0
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}
Beispiel #3
0
 def test_index_list_for_a_specific_day(self):
     tickers = stock.get_index_ticker_list('20210118')
     self.assertIsInstance(tickers, list)
     self.assertGreater(len(tickers), 0)
     self.assertEqual(tickers[0], '1001')
Beispiel #4
0
 def test_index_list_in_theme(self):
     tickers = stock.get_index_ticker_list('20210130', '테마')
     self.assertIsInstance(tickers, list)
     self.assertGreater(len(tickers), 0)
     self.assertEqual(tickers[0], '1163')
Beispiel #5
0
 def test_index_list_in_kosdaq(self):
     tickers = stock.get_index_ticker_list('20210130', 'KOSDAQ')
     self.assertIsInstance(tickers, list)
     self.assertGreater(len(tickers), 0)
     self.assertEqual(tickers[0], '2001')
Beispiel #6
0
def get_index():
    kospi_index = stock.get_index_ticker_list(market='KOSPI')
    kosdaq_index = stock.get_index_ticker_list(market='KOSDAQ')
    time.sleep(1)
    return kospi_index, kosdaq_index
Beispiel #7
0
 def test_index_list_for_a_holiday(self):
     tickers = stock.get_index_ticker_list('20210130')
     self.assertIsInstance(tickers, list)
     self.assertEqual(len(tickers), 46)
     self.assertEqual(tickers[0], '1001')
Beispiel #8
0
 def test_io_with_default_param(self):
     tickers = stock.get_index_ticker_list()
     self.assertIsInstance(tickers, list)
     self.assertNotEqual(len(tickers), 0)