def test_investpy_certificates(): """ This function checks that certificate data retrieval functions listed in investpy work properly. """ params = [ { 'country': 'france', }, { 'country': None, }, ] for param in params: investpy.get_certificates(country=param['country']) investpy.get_certificates_list(country=param['country']) params = [ { 'country': None, 'columns': ['full_name', 'name'], 'as_json': True }, { 'country': None, 'columns': ['full_name', 'name'], 'as_json': False }, { 'country': 'france', 'columns': ['full_name', 'name'], 'as_json': True }, { 'country': 'france', 'columns': ['full_name', 'name'], 'as_json': False }, { 'country': 'france', 'columns': None, 'as_json': False }, ] for param in params: investpy.get_certificates_dict(country=param['country'], columns=param['columns'], as_json=param['as_json']) investpy.get_certificate_countries() params = [ { 'as_json': True, 'order': 'ascending', }, { 'as_json': False, 'order': 'ascending', }, { 'as_json': True, 'order': 'descending', }, { 'as_json': False, 'order': 'descending', }, ] for param in params: investpy.get_certificate_recent_data(certificate='BNP Gold 31Dec99', country='france', as_json=param['as_json'], order=param['order'], interval='Daily') investpy.get_certificate_historical_data(certificate='BNP Gold 31Dec99', country='france', from_date='01/01/1990', to_date='01/01/2019', as_json=param['as_json'], order=param['order'], interval='Daily') params = [ { 'certificate': 'BNP Gold 31Dec99', 'country': 'france', 'as_json': False }, { 'certificate': 'BNP Gold 31Dec99', 'country': 'france', 'as_json': True } ] for param in params: investpy.get_certificate_information(certificate=param['certificate'], country=param['country'], as_json=param['as_json']) params = [ { 'country': 'france', 'as_json': True, 'n_results': 10 }, { 'country': 'france', 'as_json': False, 'n_results': 10 } ] for param in params: investpy.get_certificates_overview(country=param['country'], as_json=param['as_json'], n_results=param['n_results']) investpy.search_certificates(by='name', value='BNP')
# 그래프: OHLC 차트 그리기 mpf.plot(investpy_candle_chart, title="S&P 500 OHLC Chart", type="ohlc") # 그래프: 캔들차트(컬러) 그리기 kwargs = dict(title="S&P 500 Customized Chart", type="candle", mav=(2, 4, 6), volume=True, ylabel="OHLC Candles") mc = mpf.make_marketcolors(up="r", down="b", inherit=True) s = mpf.make_mpf_style(marketcolors=mc) mpf.plot(investpy_candle_chart, **kwargs, style=s) ######################################################################################################################## # 현재 접근 가능한 국가 리스트 countriesAvailable = investpy.get_certificate_countries() print(countriesAvailable) # 현재 접근 가능한 주식 currentCountry = countriesAvailable[1] stocks = investpy.get_stocks(currentCountry) print(stocks) print(type(stocks)) # 미국 ETF 리스트 검색 df_us_etf = investpy.get_etfs(country='United States') df_us_etf_search = df_us_etf[df_us_etf['symbol'].str.contains("IEF")] countriesAvailable = investpy.get_index_countries() investpy.indices.get_indices_list(country=None)