Skip to content

Commit

Permalink
Merge pull request FinanceData#44 from radish-greens/master
Browse files Browse the repository at this point in the history
add administrative listing
  • Loading branch information
FinanceData authored Sep 30, 2020
2 parents d9c892d + 6101ba1 commit c8f7c35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from FinanceDataReader.krx.data import (KrxDelistingReader)
from FinanceDataReader.naver.data import (NaverDailyReader)
from FinanceDataReader.nasdaq.listing import (NasdaqStockListing)
from FinanceDataReader.krx.listing import (KrxStockListing, KrxDelisting)
from FinanceDataReader.krx.listing import (KrxStockListing, KrxDelisting, KrxAdministrative)
from FinanceDataReader.wikipedia.listing import (WikipediaStockListing)
from FinanceDataReader.investing.listing import (InvestingEtfListing)
from FinanceDataReader.naver.listing import (NaverEtfListing)
Expand Down Expand Up @@ -39,6 +39,8 @@ def StockListing(market):
return KrxStockListing(market).read()
if market in [ 'KRX-DELISTING' ]:
return KrxDelisting(market).read()
if market in [ 'KRX-ADMINISTRATIVE' ]:
return KrxAdministrative(market).read()
if market in [ 'S&P500', 'SP500']:
return WikipediaStockListing(market).read()
else:
Expand Down
15 changes: 14 additions & 1 deletion krx/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,17 @@ def read(self):
df['종목코드'] = df['종목코드'].str.replace('A', '')
df['폐지일'] = pd.to_datetime(df['폐지일'])
col_map = {'종목코드':'Symbol', '기업명':'Name', '폐지일':'DelistingDate', '폐지사유':'Reason'}
return df.rename(columns=col_map)
return df.rename(columns=col_map)

class KrxAdministrative:
def __init__(self, market):
self.market = market

def read(self):
url = "http://kind.krx.co.kr/investwarn/adminissue.do?method=searchAdminIssueSub&currentPageSize=5000&forward=adminissue_down"
df = pd.read_html(url, header=0)[0]
df['종목코드'] = df['종목코드'].apply(lambda x: '{:0>6d}'.format(x))
df['지정일'] = pd.to_datetime(df['지정일'])
col_map = {'종목코드':'Symbol', '종목명':'Name', '지정일':'DesignationDate', '지정사유':'Reason'}
df.rename(columns=col_map, inplace=True)
return df[['Symbol', 'Name', 'DesignationDate', 'Reason']]

0 comments on commit c8f7c35

Please sign in to comment.